1COMMENT(7)              PostgreSQL 9.2.24 Documentation             COMMENT(7)
2
3
4

NAME

6       COMMENT - define or change the comment of an object
7

SYNOPSIS

9       COMMENT ON
10       {
11         AGGREGATE agg_name (agg_type [, ...] ) |
12         CAST (source_type AS target_type) |
13         COLLATION object_name |
14         COLUMN relation_name.column_name |
15         CONSTRAINT constraint_name ON table_name |
16         CONVERSION object_name |
17         DATABASE object_name |
18         DOMAIN object_name |
19         EXTENSION object_name |
20         FOREIGN DATA WRAPPER object_name |
21         FOREIGN TABLE object_name |
22         FUNCTION function_name ( [ [ argmode ] [ argname ] argtype [, ...] ] ) |
23         INDEX object_name |
24         LARGE OBJECT large_object_oid |
25         OPERATOR operator_name (left_type, right_type) |
26         OPERATOR CLASS object_name USING index_method |
27         OPERATOR FAMILY object_name USING index_method |
28         [ PROCEDURAL ] LANGUAGE object_name |
29         ROLE object_name |
30         RULE rule_name ON table_name |
31         SCHEMA object_name |
32         SEQUENCE object_name |
33         SERVER object_name |
34         TABLE object_name |
35         TABLESPACE object_name |
36         TEXT SEARCH CONFIGURATION object_name |
37         TEXT SEARCH DICTIONARY object_name |
38         TEXT SEARCH PARSER object_name |
39         TEXT SEARCH TEMPLATE object_name |
40         TRIGGER trigger_name ON table_name |
41         TYPE object_name |
42         VIEW object_name
43       } IS 'text'
44

DESCRIPTION

46       COMMENT stores a comment about a database object.
47
48       Only one comment string is stored for each object, so to modify a
49       comment, issue a new COMMENT command for the same object. To remove a
50       comment, write NULL in place of the text string. Comments are
51       automatically dropped when their object is dropped.
52
53       For most kinds of object, only the object's owner can set the comment.
54       Roles don't have owners, so the rule for COMMENT ON ROLE is that you
55       must be superuser to comment on a superuser role, or have the
56       CREATEROLE privilege to comment on non-superuser roles. Of course, a
57       superuser can comment on anything.
58
59       Comments can be viewed using psql's \d family of commands. Other user
60       interfaces to retrieve comments can be built atop the same built-in
61       functions that psql uses, namely obj_description, col_description, and
62       shobj_description (see Table 9.55, “Comment Information Functions”).
63

PARAMETERS

65       object_name, relation_name.column_name, agg_name, constraint_name,
66       function_name, operator_name, rule_name, trigger_name
67           The name of the object to be commented. Names of tables,
68           aggregates, collations, conversions, domains, foreign tables,
69           functions, indexes, operators, operator classes, operator families,
70           sequences, text search objects, types, and views can be
71           schema-qualified. When commenting on a column, relation_name must
72           refer to a table, view, composite type, or foreign table.
73
74       agg_type
75           An input data type on which the aggregate function operates. To
76           reference a zero-argument aggregate function, write * in place of
77           the list of input data types.
78
79       source_type
80           The name of the source data type of the cast.
81
82       target_type
83           The name of the target data type of the cast.
84
85       argmode
86           The mode of a function argument: IN, OUT, INOUT, or VARIADIC. If
87           omitted, the default is IN. Note that COMMENT ON FUNCTION does not
88           actually pay any attention to OUT arguments, since only the input
89           arguments are needed to determine the function's identity. So it is
90           sufficient to list the IN, INOUT, and VARIADIC arguments.
91
92       argname
93           The name of a function argument. Note that COMMENT ON FUNCTION does
94           not actually pay any attention to argument names, since only the
95           argument data types are needed to determine the function's
96           identity.
97
98       argtype
99           The data type(s) of the function's arguments (optionally
100           schema-qualified), if any.
101
102       large_object_oid
103           The OID of the large object.
104
105       left_type, right_type
106           The data type(s) of the operator's arguments (optionally
107           schema-qualified). Write NONE for the missing argument of a prefix
108           or postfix operator.
109
110       PROCEDURAL
111           This is a noise word.
112
113       text
114           The new comment, written as a string literal; or NULL to drop the
115           comment.
116

NOTES

118       There is presently no security mechanism for viewing comments: any user
119       connected to a database can see all the comments for objects in that
120       database. For shared objects such as databases, roles, and tablespaces,
121       comments are stored globally so any user connected to any database in
122       the cluster can see all the comments for shared objects. Therefore,
123       don't put security-critical information in comments.
124

EXAMPLES

126       Attach a comment to the table mytable:
127
128           COMMENT ON TABLE mytable IS 'This is my table.';
129
130       Remove it again:
131
132           COMMENT ON TABLE mytable IS NULL;
133
134       Some more examples:
135
136           COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample variance';
137           COMMENT ON CAST (text AS int4) IS 'Allow casts from text to int4';
138           COMMENT ON COLLATION "fr_CA" IS 'Canadian French';
139           COMMENT ON COLUMN my_table.my_column IS 'Employee ID number';
140           COMMENT ON CONVERSION my_conv IS 'Conversion to UTF8';
141           COMMENT ON CONSTRAINT bar_col_cons ON bar IS 'Constrains column col';
142           COMMENT ON DATABASE my_database IS 'Development Database';
143           COMMENT ON DOMAIN my_domain IS 'Email Address Domain';
144           COMMENT ON EXTENSION hstore IS 'implements the hstore data type';
145           COMMENT ON FOREIGN DATA WRAPPER mywrapper IS 'my foreign data wrapper';
146           COMMENT ON FOREIGN TABLE my_foreign_table IS 'Employee Information in other database';
147           COMMENT ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral';
148           COMMENT ON INDEX my_index IS 'Enforces uniqueness on employee ID';
149           COMMENT ON LANGUAGE plpython IS 'Python support for stored procedures';
150           COMMENT ON LARGE OBJECT 346344 IS 'Planning document';
151           COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two texts';
152           COMMENT ON OPERATOR - (NONE, integer) IS 'Unary minus';
153           COMMENT ON OPERATOR CLASS int4ops USING btree IS '4 byte integer operators for btrees';
154           COMMENT ON OPERATOR FAMILY integer_ops USING btree IS 'all integer operators for btrees';
155           COMMENT ON ROLE my_role IS 'Administration group for finance tables';
156           COMMENT ON RULE my_rule ON my_table IS 'Logs updates of employee records';
157           COMMENT ON SCHEMA my_schema IS 'Departmental data';
158           COMMENT ON SEQUENCE my_sequence IS 'Used to generate primary keys';
159           COMMENT ON SERVER myserver IS 'my foreign server';
160           COMMENT ON TABLE my_schema.my_table IS 'Employee Information';
161           COMMENT ON TABLESPACE my_tablespace IS 'Tablespace for indexes';
162           COMMENT ON TEXT SEARCH CONFIGURATION my_config IS 'Special word filtering';
163           COMMENT ON TEXT SEARCH DICTIONARY swedish IS 'Snowball stemmer for Swedish language';
164           COMMENT ON TEXT SEARCH PARSER my_parser IS 'Splits text into words';
165           COMMENT ON TEXT SEARCH TEMPLATE snowball IS 'Snowball stemmer';
166           COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for RI';
167           COMMENT ON TYPE complex IS 'Complex number data type';
168           COMMENT ON VIEW my_view IS 'View of departmental costs';
169

COMPATIBILITY

171       There is no COMMENT command in the SQL standard.
172
173
174
175PostgreSQL 9.2.24                 2017-11-06                        COMMENT(7)
Impressum