pg_description

A system table storing comments for database objects

pg_description is a system catalogue table storing comments for database objects.

pg_description was added in PostgreSQL 6.3.

Purpose

pg_description stores arbitrary user-defined descriptions for objects in the current database defined by the COMMENT ON command.

For comments on global objects (roles, tablespaces etc.), see pg_shdescription.

Definition by PostgreSQL version

pg_description (PostgreSQL 14)

           Table "pg_catalog.pg_description"
   Column    |  Type   | Collation | Nullable | Default 
-------------+---------+-----------+----------+---------
 objoid      | oid     |           | not null | 
 classoid    | oid     |           | not null | 
 objsubid    | integer |           | not null | 
 description | text    | C         | not null | 
Indexes:
    "pg_description_o_c_o_index" PRIMARY KEY, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 13)

           Table "pg_catalog.pg_description"
   Column    |  Type   | Collation | Nullable | Default 
-------------+---------+-----------+----------+---------
 objoid      | oid     |           | not null | 
 classoid    | oid     |           | not null | 
 objsubid    | integer |           | not null | 
 description | text    | C         | not null | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 12)

           Table "pg_catalog.pg_description"
   Column    |  Type   | Collation | Nullable | Default 
-------------+---------+-----------+----------+---------
 objoid      | oid     |           | not null | 
 classoid    | oid     |           | not null | 
 objsubid    | integer |           | not null | 
 description | text    | C         | not null | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 11)

           Table "pg_catalog.pg_description"
   Column    |  Type   | Collation | Nullable | Default 
-------------+---------+-----------+----------+---------
 objoid      | oid     |           | not null | 
 classoid    | oid     |           | not null | 
 objsubid    | integer |           | not null | 
 description | text    |           | not null | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 10)

           Table "pg_catalog.pg_description"
   Column    |  Type   | Collation | Nullable | Default 
-------------+---------+-----------+----------+---------
 objoid      | oid     |           | not null | 
 classoid    | oid     |           | not null | 
 objsubid    | integer |           | not null | 
 description | text    |           | not null | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 9.6)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | not null
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 9.5)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | not null
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 9.4)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 9.3)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 9.2)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 9.1)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 9.0)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 8.4)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 8.3)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

pg_description (PostgreSQL 8.2)

 Table "pg_catalog.pg_description"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 objoid      | oid     | not null
 classoid    | oid     | not null
 objsubid    | integer | not null
 description | text    | 
Indexes:
    "pg_description_o_c_o_index" UNIQUE, btree (objoid, classoid, objsubid)
    

Documentation: pg_description

Change history

Examples

Add a comment to a table:

postgres=# COMMENT ON TABLE foo IS 'Store all the things';
COMMENT

postgres=# SELECT * FROM pg_description WHERE objoid = 'foo'::REGCLASS;
 objoid | classoid | objsubid |     description      
--------+----------+----------+----------------------
  16470 |     1259 |        0 | Store all the things
(1 row)

Remove a comment from a table:

postgres=# COMMENT ON TABLE foo IS NULL;
COMMENT

postgres=# SELECT * FROM pg_description WHERE objoid = 'foo'::REGCLASS;
 objoid | classoid | objsubid | description 
--------+----------+----------+-------------
(0 rows)

Categories

DDL, System catalogue

See also

COMMENT ON, pg_shdescription, obj_description()