Overview

The col_description() is a comment information function that retrieves the comment associated with a specified table column.

Syntax

The syntax for the col_description() function is as follows:

col_description (table_oid, column_number) → NULL

Parameters

The following parameters are required to execute this function:

  • table_oid: specifies the object identifier (OID) of the table containing the column for which you want to retrieve the comment
  • column_number: indicates the ordinal position of the column within the table (starting from 1 for the first column)
It is important to note that the column number must be provided as an object identifier (OID), which can be achieved by casting the table name to regclass

Restrictions

  • This function always returns NULL if there are no parameters specified