Updated on 2025-05-29 GMT+08:00

Comment Information Functions

col_description(table_oid, column_number)

Description: Obtains the comment for a table column.

Return type: text

Note: col_description returns the comment for a table column, which is specified by the OID of its table and its column number.

obj_description(object_oid, catalog_name)

Description: Obtains the comment for a database object.

Return type: text

Note: The two-parameter form of obj_description returns the comment for a database object specified by its OID and the name of the system catalog to which it belongs. For example, obj_description(123456,'pg_class') would retrieve the comment for the table with OID 123456. The one-parameter form of obj_description requires only the OID.

obj_description cannot be used for table columns since columns do not have OIDs of their own.

obj_description(object_oid)

Description: Obtains the comment for a database object.

Return type: text

shobj_description(object_oid, catalog_name)

Description: Obtains the comment for a shared database object.

Return type: text

Note: shobj_description is used just like obj_description, except that the former is used for shared objects. Some system catalogs are global to all databases in the cluster, and the comments for objects in them are stored globally as well.