Home Explore Blog CI



postgresql

5th chunk of `doc/src/sgml/ref/comment.sgml`
c2c8af9d9bd4bd219e856fd8e06684f16f85945b7bbbe65d0000000100000924
      The name of the language of the transform.
      </para>
     </listitem>
    </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">string_literal</replaceable></term>
    <listitem>
     <para>
      The new comment contents, written as a string literal.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>NULL</literal></term>
    <listitem>
     <para>
      Write <literal>NULL</literal> to drop the comment.
     </para>
    </listitem>
   </varlistentry>

  </variablelist>
 </refsect1>

 <refsect1>
  <title>Notes</title>

  <para>
   There is presently no security mechanism for viewing comments: any user
   connected to a database can see all the comments for objects in
   that database.  For shared objects such as
   databases, roles, and tablespaces, comments are stored globally so any
   user connected to any database in the cluster can see all the comments
   for shared objects.  Therefore, don't put security-critical
   information in comments.
  </para>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   Attach a comment to the table <literal>mytable</literal>:

<programlisting>
COMMENT ON TABLE mytable IS 'This is my table.';
</programlisting>

   Remove it again:

<programlisting>
COMMENT ON TABLE mytable IS NULL;
</programlisting>
  </para>

  <para>
   Some more examples:

<programlisting>
COMMENT ON ACCESS METHOD gin IS 'GIN index access method';
COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample variance';
COMMENT ON CAST (text AS int4) IS 'Allow casts from text to int4';
COMMENT ON COLLATION "fr_CA" IS 'Canadian French';
COMMENT ON COLUMN my_table.my_column IS 'Employee ID number';
COMMENT ON CONVERSION my_conv IS 'Conversion to UTF8';
COMMENT ON CONSTRAINT bar_col_cons ON bar IS 'Constrains column col';
COMMENT ON CONSTRAINT dom_col_constr ON DOMAIN dom IS 'Constrains col of domain';
COMMENT ON DATABASE my_database IS 'Development Database';
COMMENT ON DOMAIN my_domain IS 'Email Address Domain';
COMMENT ON EVENT TRIGGER abort_ddl IS 'Aborts all DDL commands';
COMMENT ON EXTENSION hstore IS 'implements the hstore data type';
COMMENT ON FOREIGN DATA WRAPPER mywrapper IS 'my foreign data wrapper';
COMMENT ON FOREIGN TABLE my_foreign_table IS 'Employee Information in other database';
COMMENT

Title: COMMENT Parameter Descriptions and Examples
Summary
This section describes parameters `string_literal` and `NULL` for the COMMENT command, explaining how to add or remove comments. It also includes a note about the lack of security for viewing comments, advising against storing sensitive information in them. Finally, it provides examples of how to attach and remove comments on various database objects, such as tables, access methods, aggregates, casts, collations, columns, conversions, constraints, databases, domains, event triggers, extensions, foreign data wrappers, and foreign tables.