Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9935a85

Browse files
committed
Document obj_description and col_description functions; expand
description of COMMENT command.
1 parent44d1e9d commit9935a85

File tree

2 files changed

+85
-7
lines changed

2 files changed

+85
-7
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.88 2001/12/23 20:22:49 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.89 2001/12/27 21:36:57 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -2643,7 +2643,7 @@ PostgreSQL documentation
26432643
<row>
26442644
<entry><function>current_timestamp</function></entry>
26452645
<entry><type>timestamp</type></entry>
2646-
<entry>date and time; see also <link
2646+
<entry>Date and time; see <link
26472647
linkend="functions-datetime-current">below</link>
26482648
</entry>
26492649
<entry></entry>
@@ -2722,7 +2722,7 @@ PostgreSQL documentation
27222722
<entry><function>now</function>()</entry>
27232723
<entry><type>timestamp</type></entry>
27242724
<entry>Current date and time (equivalent to
2725-
<function>current_timestamp</function>); seealso<link
2725+
<function>current_timestamp</function>); see <link
27262726
linkend="functions-datetime-current">below</link>
27272727
</entry>
27282728
<entry></entry>
@@ -4399,6 +4399,66 @@ SELECT NULLIF(value, '(none)') ...
43994399
<structfield>usesysid</> value.
44004400
</para>
44014401

4402+
<table>
4403+
<title>Comment Information Functions</>
4404+
<tgroup cols="3">
4405+
<thead>
4406+
<row><entry>Name</> <entry>Return Type</> <entry>Description</></row>
4407+
</thead>
4408+
4409+
<tbody>
4410+
<row>
4411+
<entry><function>obj_description</>(<parameter>objectOID</parameter>, <parameter>tablename</>)</entry>
4412+
<entry><type>text</></entry>
4413+
<entry>Get comment for a database object</>
4414+
</row>
4415+
<row>
4416+
<entry><function>obj_description</>(<parameter>objectOID</parameter>)</entry>
4417+
<entry><type>text</></entry>
4418+
<entry>Get comment for a database object (<emphasis>deprecated</>)</entry>
4419+
</row>
4420+
<row>
4421+
<entry><function>col_description</>(<parameter>tableOID</parameter>, <parameter>columnnumber</>)</entry>
4422+
<entry><type>text</></entry>
4423+
<entry>Get comment for a table column</>
4424+
</row>
4425+
</tbody>
4426+
</tgroup>
4427+
</table>
4428+
4429+
<indexterm zone="functions-misc">
4430+
<primary>obj_description</primary>
4431+
</indexterm>
4432+
4433+
<indexterm zone="functions-misc">
4434+
<primary>col_description</primary>
4435+
</indexterm>
4436+
4437+
<para>
4438+
These functions extract comments previously stored with the
4439+
<command>COMMENT</> command. <literal>NULL</> is returned if
4440+
no comment can be found matching the specified parameters.
4441+
</para>
4442+
4443+
<para>
4444+
The two-parameter form of <function>obj_description()</> returns the
4445+
comment for a database object specified by its OID and the name of the
4446+
containing system catalog. For example,
4447+
<literal>obj_description(123456,'pg_class')</>
4448+
would retrieve the comment for a table with OID 123456.
4449+
The one-parameter form of <function>obj_description()</> requires only
4450+
the object OID. It is now deprecated since there is no guarantee that
4451+
OIDs are unique across different system catalogs; therefore, the wrong
4452+
comment could be returned.
4453+
</para>
4454+
4455+
<para>
4456+
<function>col_description()</> returns the comment for a table column,
4457+
which is specified by the OID of its table and its column number.
4458+
<function>obj_description()</> cannot be used for table columns since
4459+
columns do not have OIDs of their own.
4460+
</para>
4461+
44024462
</sect1>
44034463

44044464

‎doc/src/sgml/ref/comment.sgml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.11 2001/12/08 03:24:34 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.12 2001/12/27 21:36:57 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -98,12 +98,30 @@ COMMENT
9898
Description
9999
</title>
100100
<para>
101-
<command>COMMENT</command> adds a comment to an object that can be
101+
<command>COMMENT</command> stores a comment about a database object.
102+
Comments can be
102103
easily retrieved with <command>psql</command>'s
103-
<command>\dd</command>, <command>\d+</command>, or <command>\l+</command> commands.
104-
To remove a comment, write <literal>NULL</literal>.
104+
<command>\dd</command>, <command>\d+</command>, or <command>\l+</command>
105+
commands. Other user interfaces to retrieve comments can be built atop
106+
the same built-in functions that <command>psql</command> uses, namely
107+
<function>obj_description()</> and <function>col_description()</>.
108+
</para>
109+
110+
<para>
111+
To modify a comment, issue a new <command>COMMENT</> command for the
112+
same object. Only one comment string is stored for each object.
113+
To remove a comment, write <literal>NULL</literal> in place of the text
114+
string.
105115
Comments are automatically dropped when the object is dropped.
106116
</para>
117+
118+
<para>
119+
It should be noted that there is presently no security mechanism
120+
for comments: any user connected to a database can see all the comments
121+
for objects in that database (although only superusers can change
122+
comments for objects that they don't own). Therefore, don't put
123+
security-critical information in comments.
124+
</para>
107125
</refsect1>
108126

109127
<refsect1 id="R1-SQL-COMMENT-2">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp