pgsql:添加注释与查询注释
1.添加注释--语法comment on [type] [target] is [comment]--为表添加注释comment on table user is 'The user table';--为字段注释comment on column user.userid is 'The user ID';2.查询注释--查询字段注释,objsubid为表中字段的序号,从左侧从1开始select d
·
1.添加注释
--语法
comment on [type] [target] is [comment]
--为表添加注释
comment on table user is 'The user table';
--为字段注释
comment on column user.userid is 'The user ID';
2.查询注释
--查询字段注释,objsubid为表中字段的序号,从左侧从1开始
select description from pg_description
join pg_class on pg_description.objoid = pg_class.oid
where relname = 'tablename'
--查询表名、表注释
select relname as tabname,
cast(obj_description(relfilenode,'pg_class') as varchar) as comment from pg_class c
where relkind = 'r' and relname not like 'pg_%' and relname not like 'sql_%' order by relname
查询字段注释
select description from pg_description join pg_class on pg_description.objoid = pg_class.oid where relname = '表名'
更多推荐
已为社区贡献1条内容
所有评论(0)