- 添加表注释
1
| COMMENT ON TABLE "public".t1 IS '表注释内容';
|
- 查看注释
1
| select description from pg_description join pg_class on pg_description.objoid = pg_class.oid where relname = 't1';
|
注释存储在 pg_description 表的 description 字段中,用来查找的每张表的 objoid 存储在 pg_class 中。
- 添加列注释
1
2
| create table t1(id int primary key, cc char(10));
comment on column t1.id is '列注释内容';
|
- Postgres 查重复数据
1
| select * from pg_public_tree_node ou where (select count(*) from pg_public_tree_node inr where inr.id = ou.id) > 1;
|