1999-10-26 05:48:58 +02:00
|
|
|
<!--
|
1999-10-26 05:53:35 +02:00
|
|
|
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.2 1999/10/26 03:53:35 momjian Exp $
|
1999-10-26 05:48:58 +02:00
|
|
|
Postgres documentation
|
|
|
|
-->
|
|
|
|
|
|
|
|
<refentry id="SQL-COMMENT">
|
|
|
|
<refmeta>
|
|
|
|
<refentrytitle id="SQL-COMMENT-TITLE">
|
|
|
|
COMMENT
|
|
|
|
</refentrytitle>
|
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
|
|
<refname>
|
|
|
|
COMMENT
|
|
|
|
</refname>
|
|
|
|
<refpurpose>
|
|
|
|
Add comment to an object
|
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<refsynopsisdivinfo>
|
|
|
|
<date>1999-07-20</date>
|
|
|
|
</refsynopsisdivinfo>
|
|
|
|
<synopsis>
|
|
|
|
COMMENT ON
|
|
|
|
[
|
|
|
|
[ DATABASE | INDEX | RULE | SEQUENCE | TABLE | TYPE | VIEW ]
|
|
|
|
<replaceable class="PARAMETER">object_name</replaceable> |
|
|
|
|
COLUMN <replaceable class="PARAMETER">table_name</replaceable>.<replaceable class="PARAMETER">column_name</replaceable>|
|
|
|
|
AGGREGATE <replaceable class="PARAMETER">agg_name</replaceable> <replaceable class="PARAMETER">agg_type</replaceable>|
|
|
|
|
FUNCTION <replaceable class="PARAMETER">func_name</replaceable> (<replaceable class="PARAMETER">arg1</replaceable>, <replaceable class="PARAMETER">arg2</replaceable>, ...)|
|
|
|
|
OPERATOR <replaceable class="PARAMETER">op</replaceable> (<replaceable class="PARAMETER">leftoperand_type</replaceable> <replaceable class="PARAMETER">rightoperand_type</replaceable>) |
|
|
|
|
TRIGGER <replaceable class="PARAMETER">trigger_name</replaceable> ON <replaceable class="PARAMETER">table_name</replaceable>
|
|
|
|
] IS <replaceable class="PARAMETER">'text'</replaceable>
|
|
|
|
</synopsis>
|
|
|
|
|
|
|
|
<refsect2 id="R2-SQL-COMMENT-1">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1999-10-25</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
|
|
|
Inputs
|
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable class="PARAMETER">object_name, table_name,
|
|
|
|
column_name, agg_name, func_name, op, trigger_name</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The name of the object to be be commented.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable class="PARAMETER">text</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The comment to add.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect2>
|
|
|
|
|
|
|
|
<refsect2 id="R2-SQL-COMMENT-2">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1998-09-08</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
|
|
|
Outputs
|
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><computeroutput>
|
|
|
|
COMMENT
|
|
|
|
</computeroutput></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Message returned if the table is successfully commented.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect2>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1 id="R1-SQL-COMMENT-1">
|
|
|
|
<refsect1info>
|
|
|
|
<date>1998-10-25</date>
|
|
|
|
</refsect1info>
|
|
|
|
<title>
|
|
|
|
Description
|
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
<command>COMMENT</command> adds a comment to an object that can be
|
|
|
|
easily retrieved with <application>psql's</application>
|
|
|
|
<emphasize>\dd</emphasize> command.
|
|
|
|
To remove a comment, use <literal>''</literal>.
|
1999-10-26 05:53:35 +02:00
|
|
|
Comments are automatically dropped when the object is dropped.
|
1999-10-26 05:48:58 +02:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 id="R1-SQL-COMMENT-2">
|
|
|
|
<title>
|
|
|
|
Usage
|
|
|
|
</title>
|
|
|
|
<para>
|
1999-10-26 05:53:35 +02:00
|
|
|
Comment the table <literal>mytable</literal>:
|
1999-10-26 05:48:58 +02:00
|
|
|
|
|
|
|
<programlisting>
|
|
|
|
COMMENT ON mytable IS 'This is my table.';
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
1999-10-26 05:53:35 +02:00
|
|
|
|
|
|
|
<para>
|
|
|
|
Some more examples:
|
|
|
|
|
|
|
|
<programlisting>
|
|
|
|
COMMENT ON DATABASE my_database IS 'Development Database';
|
|
|
|
COMMENT ON INDEX my_index IS 'Enforces uniqueness on employee id';
|
|
|
|
COMMENT ON RULE my_rule IS 'Logs UPDATES of employee records';
|
|
|
|
COMMENT ON SEQUENCE my_sequence IS 'Used to generate primary keys';
|
|
|
|
COMMENT ON TABLE my_table IS 'Employee Information';
|
|
|
|
COMMENT ON TYPE my_type IS 'Complex Number support';
|
|
|
|
COMMENT ON VIEW my_view IS 'View of departmental costs';
|
|
|
|
COMMENT ON COLUMN my_table.my_field IS 'Employee ID number';
|
|
|
|
COMMENT ON AGGREGATE my_aggregate float8 IS 'Computes sample variance';
|
|
|
|
COMMENT ON FUNCTION my_function (datetime) IS 'Returns Roman Numeral';
|
|
|
|
COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two text';
|
|
|
|
COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for R.I.';
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
1999-10-26 05:48:58 +02:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 id="R1-SQL-COMMENT-3">
|
|
|
|
<title>
|
|
|
|
Compatibility
|
|
|
|
</title>
|
|
|
|
|
|
|
|
<refsect2 id="R2-SQL-COMMENT-4">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1998-09-08</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
|
|
|
SQL92
|
|
|
|
</title>
|
|
|
|
<para>
|
|
|
|
There is no <command>COMMENT</command> in <acronym>SQL92</acronym>.
|
|
|
|
</para>
|
|
|
|
</refsect2>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../reference.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:"/usr/lib/sgml/catalog"
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
-->
|