COMMENT ON statement associates comments to databases, tables, columns, or indexes.
The
COMMENT ON statement performs a schema change. For more information about how online schema changes work in CockroachDB, see Online Schema Changes.Required privileges
The user must have theCREATE privilege on the object they are commenting on.
Synopsis
Parameters
Examples
Setup
The following examples use MovR, a fictional vehicle-sharing application, to demonstrate CockroachDB SQL statements. For more information about the MovR example application and dataset, see MovR: A Global Vehicle-sharing App. To follow along, runcockroach demo to start a temporary, in-memory cluster with the movr dataset preloaded:
Add a comment to a database
To add a comment to a database:SHOW DATABASES:
Add a comment to a table
To add a comment to a table:SHOW TABLES:
SHOW CREATE:
Add a comment to a column
To add a comment to a column:SHOW COLUMNS:
Add a comment to an index
Suppose we create an index on thename column of the users table:
SHOW INDEXES ... WITH COMMENT:

