shobj_description() is a system function returning the comment for a shared object
shobj_description() was added in PostgreSQL 8.2.
shobj_description ( object oid, catalog name ) → text
Given an OID and the name of the appropriate system catalog table,
shobj_description() returns the comment for the shared object (as defined by
COMMENT ON), or
NULL if no comment has been specified.
postgres=# COMMENT ON TABLESPACE tblspc_2 IS 'Store a few of the things'; COMMENT postgres=# SELECT shobj_description( (SELECT oid FROM pg_tablespace WHERE spcname = 'tblspc_2'), 'pg_tablespace'); shobj_description --------------------------- Store a few of the things (1 row)