COMMENT

Synopsis

Use the COMMENT statement to set, update, or remove a comment on a database object.

Syntax

comment_on ::= COMMENT ON 
               { ACCESS METHOD access_method_name
                 | AGGREGATE aggregate_name ( aggregate_signature )
                 | CAST ( source_type AS target_type )
                 | COLLATION object_name
                 | COLUMN relation_name . column_name
                 | CONSTRAINT constraint_name ON table_name
                 | CONSTRAINT constraint_name ON DOMAIN domain_name
                 | CONVERSION object_name
                 | DATABASE object_name
                 | DOMAIN object_name
                 | EXTENSION object_name
                 | EVENT TRIGGER object_name
                 | FOREIGN DATA WRAPPER object_name
                 | FOREIGN TABLE object_name
                 | FUNCTION subprogram_name ( [ subprogram_signature ] 
                   ) | INDEX object_name
                 | LARGE OBJECT large_object_oid
                 | MATERIALIZED VIEW object_name
                 | OPERATOR operator_name ( operator_signature )
                 | OPERATOR CLASS object_name USING index_method
                 | OPERATOR FAMILY object_name USING index_method
                 | POLICY policy_name ON table_name
                 | [ PROCEDURAL ] LANGUAGE object_name
                 | PROCEDURE subprogram_name ( 
                   [ subprogram_signature ] )
                 | PUBLICATION object_name
                 | ROLE object_name
                 | ROUTINE subprogram_name ( [ subprogram_signature ] 
                   ) | RULE rule_name ON table_name
                 | SCHEMA object_name
                 | SEQUENCE object_name
                 | SERVER object_name
                 | STATISTICS object_name
                 | SUBSCRIPTION object_name
                 | TABLE object_name
                 | TABLESPACE object_name
                 | TEXT SEARCH CONFIGURATION object_name
                 | TEXT SEARCH DICTIONARY object_name
                 | TEXT SEARCH PARSER object_name
                 | TEXT SEARCH TEMPLATE object_name
                 | TRIGGER trigger_name ON table_name
                 | TYPE object_name
                 | VIEW object_name } IS { '<Text Literal>' | NULL }

comment_on

COMMENTONACCESSMETHODaccess_method_nameAGGREGATEaggregate_name(aggregate_signature)CAST(source_typeAStarget_type)COLLATIONobject_nameCOLUMNrelation_name.column_nameCONSTRAINTconstraint_nameONtable_nameCONSTRAINTconstraint_nameONDOMAINdomain_nameCONVERSIONobject_nameDATABASEobject_nameDOMAINobject_nameEXTENSIONobject_nameEVENTTRIGGERobject_nameFOREIGNDATAWRAPPERobject_nameFOREIGNTABLEobject_nameFUNCTIONsubprogram_name(subprogram_signature)INDEXobject_nameLARGEOBJECTlarge_object_oidMATERIALIZEDVIEWobject_nameOPERATORoperator_name(operator_signature)OPERATORCLASSobject_nameUSINGindex_methodOPERATORFAMILYobject_nameUSINGindex_methodPOLICYpolicy_nameONtable_namePROCEDURALLANGUAGEobject_namePROCEDUREsubprogram_name(subprogram_signature)PUBLICATIONobject_nameROLEobject_nameROUTINEsubprogram_name(subprogram_signature)RULErule_nameONtable_nameSCHEMAobject_nameSEQUENCEobject_nameSERVERobject_nameSTATISTICSobject_nameSUBSCRIPTIONobject_nameTABLEobject_nameTABLESPACEobject_nameTEXTSEARCHCONFIGURATIONobject_nameTEXTSEARCHDICTIONARYobject_nameTEXTSEARCHPARSERobject_nameTEXTSEARCHTEMPLATEobject_nameTRIGGERtrigger_nameONtable_nameTYPEobject_nameVIEWobject_nameIS<Text Literal>NULL

Semantics

To remove a comment, set the value to NULL.

comment_on

COMMENT ON

Add or change a comment about a database object. To remove a comment, set the value to NULL.

aggregate_signature

Examples

Add a comment

COMMENT ON DATABASE postgres IS 'Default database';
COMMENT ON INDEX index_name IS 'Special index';

Remove a comment

COMMENT ON TABLE some_table IS NULL;