obj_description()

A function returning an object's comment

obj_description() is a system function returning an object's comment.

obj_description() was added in PostgreSQL 6.3.

Usage

obj_description ( object oid, catalog name ) → text
obj_description ( object oid ) → text

Given an OID and the name of the appropriate system catalog table, obj_description() retuns the comment for the object (as defined by COMMENT ON), or NULL if no comment has been specified.

Note that the form obj_description ( object oid ) is deprecated as there is no guarantee that a particular OID is unique to a particular system catalog table.

Change history

Examples

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)

Categories

System function

See also

COMMENT ON, pg_description, col_description(), shobj_description(),