PostgreSQL查询表的注释和修改表的注释 - xd21303/Notebook GitHub Wiki
查询表的注释
网上搜的答案用的是relfilenode是不对的。因为relfilenode和oid可能不一致。以官方文档为准。
SELECT RELNAME AS TABNAME,
CAST (OBJ_DESCRIPTION (OID, '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;
官方文档https://www.postgresql.org/docs/13/functions-info.html
搜索OBJ_DESCRIPTION
为表添加注释
comment on table user is 'The user table';