COMMENT ON associates comments to , , , , or .
The COMMENT ON statement performs a schema change. For more information about how online schema changes work in CockroachDB, see .
Required privileges
The user must have theCREATE on the object they are commenting on.
Synopsis
Parameters
| Parameter | Description |
|---|---|
database\_name | The name of the on which you are commenting. |
schema\_name | The name of the on which you are commenting. |
type\_name | The name of the on which you are commenting. |
table\_name | The name of the on which you are commenting. |
column\_name | The name of the on which you are commenting. |
table\_index\_name | The name of the on which you are commenting. |
comment\_text | The comment () you are associating to the object. You can remove a comment by replacing the string with NULL. |
Examples
Setup
To follow along, run to start a temporary, in-memory cluster with the sample dataset preloaded:Add a comment to a database
To add a comment to a database:Add a comment to a table
To add a comment to a table:Add a comment to a column
To add a comment to a column:Add a comment to an index
Suppose we on thename column of the users table:
Add a comment to a type
Issue a SQL statement to :system.comments table:
Remove a comment from a database
To remove a comment from a database:Remove a comment from a type
To remove the comment from the type you created in the preceding example, add aNULL comment:
Known limitations
- The statement associates comments to databases, tables, or columns. However, the internal table (
system.comments) in which these comments are stored is not captured by a of an individual table or database. As a workaround, take a cluster backup instead, as thesystem.commentstable is included in cluster backups.

