FirebirdSQL logo

COMMENT ON

Adds a comment to a metadata object

Available in

DSQL

Syntax
COMMENT ON <object> IS {'sometext' | NULL}

<object> ::=
    {DATABASE | SCHEMA}
  | <basic-type> objectname
  | USER username [USING PLUGIN pluginname]
  | COLUMN relationname.fieldname
  | [{PROCEDURE | FUNCTION}] PARAMETER
      [packagename.]routinename.paramname
  | {PROCEDURE | [EXTERNAL] FUNCTION}
      [package_name.]routinename
  | [GLOBAL] MAPPING mappingname

<basic-type> ::=
    CHARACTER SET | COLLATION | DOMAIN
  | EXCEPTION     | FILTER    | GENERATOR
  | INDEX         | PACKAGE   | ROLE
  | SEQUENCE      | TABLE     | TRIGGER
  | VIEW
Table 1. COMMENT ON Statement Parameters
Parameter Description

sometext

Comment text

basic-type

Metadata object type

objectname

Metadata object name

username

Username

pluginname

User manager plugin name

relationname

Name of table or view

fieldname

Name of the column

package_name

Name of the package

routinename

Name of stored procedure or function

paramname

Name of a stored procedure or function parameter

mappingname

Name of a mapping

The COMMENT ON statement adds comments for database objects (metadata).Comments are saved to the RDB$DESCRIPTION column of the corresponding system tables.Client applications can view comments from these fields.

Note
  1. If you add an empty comment (“''”), it will be saved as NULL in the database.

  2. By default, the COMMENT ON USER statement will create comments on users managed by the default user manager (the first plugin listed in the UserManager config option).The USING PLUGIN can be used to comment on a user managed by a different user manager.

  3. Comments on users are not stored for the Legacy_UserManager.

  4. Comments on users are stored in the security database.

  5. Comments on global mappings are stored in the security database.

  6. SCHEMA is currently a synonym for DATABASE;this may change in a future version, so we recommend to always use DATABASE

Warning

Comments on users are visible to that user through the SEC$USERS virtual table.

Who Can Add a Comment

The COMMENT ON statement can be executed by:

  • Administrators

  • The owner of the object that is commented on

  • Users with the ALTER ANY object_type privilege, where object_type is the type of object commented on (e.g. PROCEDURE)