COMMENT ON CONSTRAINT
Adds, revises, or removes a comment on a constraint. Each object can have one comment. Comments are stored in the system table COMMENTS
.
Syntax
COMMENT ON CONSTRAINT constraint-name ON [ [db-name.]schema.]table-name IS ... {'comment' | NULL };
Parameters
constraint-name |
The name of the constraint associated with the comment. |
[db-name.]schema
|
Specifies a schema. If multiple schemas are defined in the database, include the schema name. For example: myschema.thisDbObject |
table-name |
Specifies the name of the table constraint with which to associate a comment. |
comment |
Specifies the comment text to add. If a comment already exists for this constraint, this comment overwrites the previous one. Comments can be up to 8192 characters in length. If a comment exceeds that limitation, Vertica truncates the comment and alerts the user with a message. You can enclose a blank value within single quotes to remove an existing comment. |
NULL |
Removes an existing comment. |
Privileges
- Superuser: View and add comments to all objects.
- Object owner: Add or edit comments for the object.
- User: VIEW privileges on an object to view its comments.
Example
The following example adds a comment to the constraint_x
constraint on the promotion_dimension table:
=> COMMENT ON CONSTRAINT constraint_x ON promotion_dimension IS 'Primary key';
The following examples remove a comment from the constraint_x
constraint on the promotion_dimension table:
=> COMMENT ON CONSTRAINT constraint_x ON promotion_dimension IS NULL; => COMMENT ON CONSTRAINT constraint_x ON promotion_dimension IS '';