obj_description() 是一个返回对象注释的系统函数。
obj_description() 于 PostgreSQL 6.3 中添加。
用法
obj_description (objectoid,catalogname ) →text
obj_description (objectoid) →text
给定一个 OID 和相应的 系统目录 表的名称,obj_description() 返回该对象的注释(由 COMMENT ON 定义),如果未指定注释则返回 NULL。
请注意,obj_description ( object oid ) 的形式已弃用,因为不能保证特定的 OID 对特定的系统目录表是唯一的。
变更历史
- PostgreSQL 7.2
obj_description ( object oid, catalog name )变体已添加(提交 bf56f075)
- PostgreSQL 6.3
- 已添加(提交 4cbc06cf)
示例
postgres=# CREATE TABLE foo (id int, val text);
CREATE TABLE
postgres=# COMMENT ON TABLE foo IS 'Store all the things';
COMMENT
postgres=# SELECT obj_description('foo'::regclass, 'pg_class');
obj_description
----------------------
Store all the things
(1 row)
参考资料
- PostgreSQL documentation: Comment Information Functions
