pg col_description 用法 pg_col_description函数用于获取指定表的指定列的说明文档。 它的语法是: pg_col_description(relation_oid, column_number) 其中,relation_oid是表的对象ID(可使用pg_class类中的relname获取),column_number是要查询的列的索引号。 该函数返回一个字符串,表示所指定列的说明文档。如果未...
pgsql查询表中字段名,类型,备注以及是否非空 SELECT col_description ( A.attrelid, A.attnum ) AS COMMENT, format_type ( A.atttypid, A.atttypmod ) AS TYPE, A.attname AS NAME, A.attnotnull AS NOTNULL FROM pg_class AS C, pg_attribute AS A WHERE C.relname='dm_ass_gp_income'AND ...
pg_catalog.col_description是一个函数,用于获取指定表和字段的注释。 (SELECT oid FROM pg_catalog.pg_class WHERE relname = 'example_table')::regclass部分用于获取example_table的OID,并将其转换为regclass类型,以便col_description函数能够识别。 'example_column'是你要查询注释的字段名。 4. 解析查询结果 执...
and relchecks=0 ) order by tablename select viewname from pg_views where schemaname in ('public', 'your schema');--获取表名,剔除分区分表;获取视图名 SELECT col_description(a.attrelid,a.attnum) as comment, pg_type.typname as typename,a.attname as name, a.attnotnull as notnull FROM...
col_description(a.attrelid,a.attnum) from pg_attribute a where attstattarget=-1 and attrelid in(select oid from pg_class where relname in (select relname as table_name from pg_class where relkind='r' and relname like 'exg_%' order by relname)) ...
col_description(a.attrelid,a.attnum) as "注释", concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '(.*)')) as "字段类型" FROM pg_class as c, pg_attribute as a, pg_type as t WHERE c.relname = 't_batch_task' ...
col_description(a.attrelid,a.attnum) as "注释", concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '(.*)')) as "字段类型" FROM pg_class as c, pg_attribute as a, pg_type as t WHERE c.relname = 't_batch_task' ...
pcolumn.ordinal_position) as ColumnDescription, case when pkey.colname = pcolumn.column_name then true else false end as IsPrimaryKey, case when pcolumn.column_default like 'nextval%' then true else false end as IsIdentity, case when pcolumn.is_nullable = 'YES' then true else false end...
col_description ( A.attrelid, A.attnum ) AS COMMENT:字段注释 attrelid:字段对应的表id(与class中的oid关联) pg_description 用来存储数据库对象(如字段、表)的描述(注释)信息。 objoid:对象OID classoid:对应表 OID objsubid:如果是字段对象,则是字段序号(位置),否则为0。 descriptiontext:描述、注释内容...
1,获取具体表的字段相关信息 SELECTcol_description (a.attrelid, a.attnum)ascomment, format_type (a.atttypid, a.atttypmod)astype, a.attnameasname, a.attnotnullasnotnullFROMpg_classasc, pg_attributeasawherec.relname='表名'anda.attrelid=c.oidanda.attnum>0orderbya.attname; ...