ok

Mini Shell

Direktori : /opt/alt/postgresql11/usr/share/doc/alt-postgresql11-9.2.24/html/
Upload File :
Current File : //opt/alt/postgresql11/usr/share/doc/alt-postgresql11-9.2.24/html/sql-comment.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>COMMENT</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 9.2.24 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SQL Commands"
HREF="sql-commands.html"><LINK
REL="PREVIOUS"
TITLE="CLUSTER"
HREF="sql-cluster.html"><LINK
REL="NEXT"
TITLE="COMMIT"
HREF="sql-commit.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2017-11-06T22:43:11"></HEAD
><BODY
CLASS="REFENTRY"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
><A
HREF="index.html"
>PostgreSQL 9.2.24 Documentation</A
></TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
TITLE="CLUSTER"
HREF="sql-cluster.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="sql-commands.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="20%"
ALIGN="right"
VALIGN="top"
><A
TITLE="COMMIT"
HREF="sql-commit.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SQL-COMMENT"
></A
>COMMENT</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN66646"
></A
><H2
>Name</H2
>COMMENT&nbsp;--&nbsp;define or change the comment of an object</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN66651"
></A
><H2
>Synopsis</H2
><PRE
CLASS="SYNOPSIS"
>COMMENT ON
{
  AGGREGATE <TT
CLASS="REPLACEABLE"
><I
>agg_name</I
></TT
> (<TT
CLASS="REPLACEABLE"
><I
>agg_type</I
></TT
> [, ...] ) |
  CAST (<TT
CLASS="REPLACEABLE"
><I
>source_type</I
></TT
> AS <TT
CLASS="REPLACEABLE"
><I
>target_type</I
></TT
>) |
  COLLATION <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  COLUMN <TT
CLASS="REPLACEABLE"
><I
>relation_name</I
></TT
>.<TT
CLASS="REPLACEABLE"
><I
>column_name</I
></TT
> |
  CONSTRAINT <TT
CLASS="REPLACEABLE"
><I
>constraint_name</I
></TT
> ON <TT
CLASS="REPLACEABLE"
><I
>table_name</I
></TT
> |
  CONVERSION <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  DATABASE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  DOMAIN <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  EXTENSION <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  FOREIGN DATA WRAPPER <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  FOREIGN TABLE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  FUNCTION <TT
CLASS="REPLACEABLE"
><I
>function_name</I
></TT
> ( [ [ <TT
CLASS="REPLACEABLE"
><I
>argmode</I
></TT
> ] [ <TT
CLASS="REPLACEABLE"
><I
>argname</I
></TT
> ] <TT
CLASS="REPLACEABLE"
><I
>argtype</I
></TT
> [, ...] ] ) |
  INDEX <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  LARGE OBJECT <TT
CLASS="REPLACEABLE"
><I
>large_object_oid</I
></TT
> |
  OPERATOR <TT
CLASS="REPLACEABLE"
><I
>operator_name</I
></TT
> (<TT
CLASS="REPLACEABLE"
><I
>left_type</I
></TT
>, <TT
CLASS="REPLACEABLE"
><I
>right_type</I
></TT
>) |
  OPERATOR CLASS <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> USING <TT
CLASS="REPLACEABLE"
><I
>index_method</I
></TT
> |
  OPERATOR FAMILY <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> USING <TT
CLASS="REPLACEABLE"
><I
>index_method</I
></TT
> |
  [ PROCEDURAL ] LANGUAGE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  ROLE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  RULE <TT
CLASS="REPLACEABLE"
><I
>rule_name</I
></TT
> ON <TT
CLASS="REPLACEABLE"
><I
>table_name</I
></TT
> |
  SCHEMA <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  SEQUENCE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  SERVER <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  TABLE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  TABLESPACE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  TEXT SEARCH CONFIGURATION <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  TEXT SEARCH DICTIONARY <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  TEXT SEARCH PARSER <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  TEXT SEARCH TEMPLATE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  TRIGGER <TT
CLASS="REPLACEABLE"
><I
>trigger_name</I
></TT
> ON <TT
CLASS="REPLACEABLE"
><I
>table_name</I
></TT
> |
  TYPE <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
> |
  VIEW <TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
>
} IS '<TT
CLASS="REPLACEABLE"
><I
>text</I
></TT
>'</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN66699"
></A
><H2
>Description</H2
><P
>   <TT
CLASS="COMMAND"
>COMMENT</TT
> stores a comment about a database object.
  </P
><P
>   Only one comment string is stored for each object, so to modify a comment,
   issue a new <TT
CLASS="COMMAND"
>COMMENT</TT
> command for the same object.  To remove a
   comment, write <TT
CLASS="LITERAL"
>NULL</TT
> in place of the text string.
   Comments are automatically dropped when their object is dropped.
  </P
><P
>   For most kinds of object, only the object's owner can set the comment.
   Roles don't have owners, so the rule for <TT
CLASS="LITERAL"
>COMMENT ON ROLE</TT
> is
   that you must be superuser to comment on a superuser role, or have the
   <TT
CLASS="LITERAL"
>CREATEROLE</TT
> privilege to comment on non-superuser roles.
   Of course, a superuser can comment on anything.
  </P
><P
>    Comments can be viewed using <SPAN
CLASS="APPLICATION"
>psql</SPAN
>'s
    <TT
CLASS="COMMAND"
>\d</TT
> family of commands.
    Other user interfaces to retrieve comments can be built atop
    the same built-in functions that <SPAN
CLASS="APPLICATION"
>psql</SPAN
> uses, namely
    <CODE
CLASS="FUNCTION"
>obj_description</CODE
>, <CODE
CLASS="FUNCTION"
>col_description</CODE
>,
    and <CODE
CLASS="FUNCTION"
>shobj_description</CODE
>
    (see <A
HREF="functions-info.html#FUNCTIONS-INFO-COMMENT-TABLE"
>Table 9-55</A
>).
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN66717"
></A
><H2
>Parameters</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="REPLACEABLE"
><I
>object_name</I
></TT
><BR><TT
CLASS="REPLACEABLE"
><I
>relation_name</I
></TT
>.<TT
CLASS="REPLACEABLE"
><I
>column_name</I
></TT
><BR><TT
CLASS="REPLACEABLE"
><I
>agg_name</I
></TT
><BR><TT
CLASS="REPLACEABLE"
><I
>constraint_name</I
></TT
><BR><TT
CLASS="REPLACEABLE"
><I
>function_name</I
></TT
><BR><TT
CLASS="REPLACEABLE"
><I
>operator_name</I
></TT
><BR><TT
CLASS="REPLACEABLE"
><I
>rule_name</I
></TT
><BR><TT
CLASS="REPLACEABLE"
><I
>trigger_name</I
></TT
></DT
><DD
><P
>      The name of the object to be commented.  Names of tables,
      aggregates, collations, conversions, domains, foreign tables, functions,
      indexes, operators, operator classes, operator families, sequences,
      text search objects, types, and views can be schema-qualified.
      When commenting on a column,
      <TT
CLASS="REPLACEABLE"
><I
>relation_name</I
></TT
> must refer
      to a table, view, composite type, or foreign table.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>agg_type</I
></TT
></DT
><DD
><P
>      An input data type on which the aggregate function operates.
      To reference a zero-argument aggregate function, write <TT
CLASS="LITERAL"
>*</TT
>
      in place of the list of input data types.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>source_type</I
></TT
></DT
><DD
><P
>       The name of the source data type of the cast.
      </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>target_type</I
></TT
></DT
><DD
><P
>       The name of the target data type of the cast.
      </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>argmode</I
></TT
></DT
><DD
><P
>      The mode of a function argument: <TT
CLASS="LITERAL"
>IN</TT
>, <TT
CLASS="LITERAL"
>OUT</TT
>,
      <TT
CLASS="LITERAL"
>INOUT</TT
>, or <TT
CLASS="LITERAL"
>VARIADIC</TT
>.
      If omitted, the default is <TT
CLASS="LITERAL"
>IN</TT
>.
      Note that <TT
CLASS="COMMAND"
>COMMENT ON FUNCTION</TT
> does not actually pay
      any attention to <TT
CLASS="LITERAL"
>OUT</TT
> arguments, since only the input
      arguments are needed to determine the function's identity.
      So it is sufficient to list the <TT
CLASS="LITERAL"
>IN</TT
>, <TT
CLASS="LITERAL"
>INOUT</TT
>,
      and <TT
CLASS="LITERAL"
>VARIADIC</TT
> arguments.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>argname</I
></TT
></DT
><DD
><P
>      The name of a function argument.
      Note that <TT
CLASS="COMMAND"
>COMMENT ON FUNCTION</TT
> does not actually pay
      any attention to argument names, since only the argument data
      types are needed to determine the function's identity.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>argtype</I
></TT
></DT
><DD
><P
>      The data type(s) of the function's arguments (optionally
      schema-qualified), if any.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>large_object_oid</I
></TT
></DT
><DD
><P
>      The OID of the large object.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>left_type</I
></TT
><BR><TT
CLASS="REPLACEABLE"
><I
>right_type</I
></TT
></DT
><DD
><P
>      The data type(s) of the operator's arguments (optionally
      schema-qualified).  Write <TT
CLASS="LITERAL"
>NONE</TT
> for the missing argument
      of a prefix or postfix operator.
     </P
></DD
><DT
><TT
CLASS="LITERAL"
>PROCEDURAL</TT
></DT
><DD
><P
>       This is a noise word.
      </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>text</I
></TT
></DT
><DD
><P
>      The new comment, written as a string literal; or <TT
CLASS="LITERAL"
>NULL</TT
>
      to drop the comment.
     </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN66807"
></A
><H2
>Notes</H2
><P
>   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.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN66810"
></A
><H2
>Examples</H2
><P
>   Attach a comment to the table <TT
CLASS="LITERAL"
>mytable</TT
>:

</P><PRE
CLASS="PROGRAMLISTING"
>COMMENT ON TABLE mytable IS 'This is my table.';</PRE
><P>

   Remove it again:

</P><PRE
CLASS="PROGRAMLISTING"
>COMMENT ON TABLE mytable IS NULL;</PRE
><P>
  </P
><P
>   Some more examples:

</P><PRE
CLASS="PROGRAMLISTING"
>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 DATABASE my_database IS 'Development Database';
COMMENT ON DOMAIN my_domain IS 'Email Address Domain';
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 ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral';
COMMENT ON INDEX my_index IS 'Enforces uniqueness on employee ID';
COMMENT ON LANGUAGE plpython IS 'Python support for stored procedures';
COMMENT ON LARGE OBJECT 346344 IS 'Planning document';
COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two texts';
COMMENT ON OPERATOR - (NONE, integer) IS 'Unary minus';
COMMENT ON OPERATOR CLASS int4ops USING btree IS '4 byte integer operators for btrees';
COMMENT ON OPERATOR FAMILY integer_ops USING btree IS 'all integer operators for btrees';
COMMENT ON ROLE my_role IS 'Administration group for finance tables';
COMMENT ON RULE my_rule ON my_table IS 'Logs updates of employee records';
COMMENT ON SCHEMA my_schema IS 'Departmental data';
COMMENT ON SEQUENCE my_sequence IS 'Used to generate primary keys';
COMMENT ON SERVER myserver IS 'my foreign server';
COMMENT ON TABLE my_schema.my_table IS 'Employee Information';
COMMENT ON TABLESPACE my_tablespace IS 'Tablespace for indexes';
COMMENT ON TEXT SEARCH CONFIGURATION my_config IS 'Special word filtering';
COMMENT ON TEXT SEARCH DICTIONARY swedish IS 'Snowball stemmer for Swedish language';
COMMENT ON TEXT SEARCH PARSER my_parser IS 'Splits text into words';
COMMENT ON TEXT SEARCH TEMPLATE snowball IS 'Snowball stemmer';
COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for RI';
COMMENT ON TYPE complex IS 'Complex number data type';
COMMENT ON VIEW my_view IS 'View of departmental costs';</PRE
><P></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN66818"
></A
><H2
>Compatibility</H2
><P
>   There is no <TT
CLASS="COMMAND"
>COMMENT</TT
> command in the SQL standard.
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sql-cluster.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sql-commit.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>CLUSTER</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="sql-commands.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>COMMIT</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

Zerion Mini Shell 1.0