(一)从pg_tables中查询表信息 select tablename from pg_tables where schemaname='ap' and tablename SIMILAR TO 'dwd_[a-z,_]+_[0-9]+' (二)从pg_class和pg_attribute根据指定的表名查询字段信息 SELECT C.relname, A.attname AS NAME, A.attnotnull AS NOTNULL, format_type ( A.atttypid, ...
format格式化 格式说明符由 % 字符引进,格式为 %[ position ] type 组件的字段有: position (optional) n$ 格式的字符串,这里的n是要打印的参数的索引。索引为1表示在formatstr之后的第一个参数。如果省略了position,默认使用序列中的下一个参数。 type (required) 格式转换的类型用来产生格式说明符的输出。支持...
(2)查询字段类型及备注(这种表中没有数据查不出来) select a.attnum,a.attname,concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '\(.*\)')) as type,d.description,typnotnull from pg_class c,pg_attribute a,pg_type t,pg_description d where c.relname='表名'...
select c.relname 表名,cast(obj_description(relfilenode,'pg_class') as varchar) 名称,a.attname 字段,d.description 字段备注,concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '\(.*\)')) as 列类型 from pg_class c,pg_attribute a,pg_type t,pg_description d ...
format_type(pg_attribute.atttypid,pg_attribute.atttypmod) as 字段类型, (case when pg_attribute.attlen > 0 then pg_attribute.attlen else pg_attribute.atttypmod - 4 end) as 数据长度, '' as 默认值, pg_attribute.attnotnull as 是否为空字段, ...
column_nameTEXT,encryption_keyTEXT)LANGUAGEplpgsqlAS$$DECLAREsql_queryTEXT;BEGINsql_query=FORMAT('...
ERROR: cannot begin/end transactions in PL/pgSQL SQL 状态: 0A000 指导建议:Use a BEGIN block with an EXCEPTION clause instead. 上下文:PL/pgSQL function “fun_td_xxx_xxx_result” line 845 at SQL statement 经过仔细检查,发现是我在845行中使用delete语句后用了commit;语句,删除该语句,问题解决了...
DataTypeOID uint32 // 数据类型OID DataTypeSize int16 // 数据类型大小 TypeModifier int32 // 类型修改器 Format int16 // 字段的格式 0为text, 1为binary } type ColumnInfo struct { Schema string // Schema名称 Table string // 表名称 OrgTable string // 原始表名称 Name string // 字段名 Or...
check_type numeric(1,0), check_msg character varying(400) ) server srv_digoal options (nspname 'digoal', relname 'table_digoal'); -- 创建临时工作表, 用于暂缓中间数据 : create table work_table_table_digoal (like table_digoal including all); ...