COMMENT ON [ [ DATABASE | INDEX | RULE | SEQUENCE | TABLE | TYPE | VIEW ] object_name | COLUMN table_name.column_name | FUNCTION func_name ( argument [, ...] ) | AGGREGATE aggr_func aggr_type | OPERATOR operator ( left_type , right_type ) | TRIGGER trigger_name ON table_name ] IS 'text'
The type of database object that you are adding a comment to.
The name of the object (database, index, rule, sequence, table, type, or view) to which you are adding a comment.
The column name within table_name you are adding a comment to.
The name of the function on which you are commenting, specified also by the argument data types that it accepts.
The aggregate function name (and associated data type aggr_type, which it accepts) to which you are adding a comment.
The name of the operator on which you are commenting (operator), further described by the data type it operates on to the left, and the data type it operates on to the right, separated by a comma, enclosed within parentheses. If either side is inapplicable, the NONE keyword may be used.
The name of the trigger on which you are placing a comment, and the name of the table upon which the trigger is placed.
The actual text of the comment to add.
COMMENT is a PostgreSQL-specific command that allows you to add comments to most objects within a database, including a database itself. Comments can be retrieved by using the following commands from within the psql client:
Displays all databases available, with comments.
Displays all database objects, with comments.
Displays all database objects in the connected database, with comments.
Displays all tables in the connected database, with comments.
Displays all indices in the connected database, with comments.
Displays all sequences in the connected database, with comments.
Displays all views in the connected database, with comments.
Displays all functions in the connected database, with comments.
Displays all aggregate functions in the connected database, with comments.
Displays all operators in the connected database, with comments.
Displays all data types in the connected database, with comments.
You can remove a comment by setting its text to NULL.
Note: A comment that has been made on an object will be removed when that object is removed from the system.