来源 http://www.itdouzi.com/postgresql/postgresql-add-comments.html
postgresql给列添加注释信息
代码如下:
| create table user ( userid int not null, phonenumber int ); comment on column user.userid is 'The user ID'; |
postgresql给表添加注释信息
|
comment
on
table
user
is
'Our session logs';
|
postgresql 查询注释信息
| select description from pg_description join pg_class on pg_description.objoid = pg_class.oid where relname = 'user' |
查询指定schema下注释信息:
|
select
description
from
pg_description
join
pg_class
on
pg_description.objoid
=
pg_class.oid
join
pg_namespace
on
pg_class.relnamespace
=
pg_namespace.oid
where
relname
=
'<table name>'
and
nspname='<schema name>'
|