Skip to content

Commit cf3b164

Browse files
committed
Add documentation for pg_get_ruledef and friends.
1 parent a157385 commit cf3b164

File tree

1 file changed

+77
-17
lines changed

1 file changed

+77
-17
lines changed

doc/src/sgml/func.sgml

Lines changed: 77 additions & 17 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.84 2001/11/21 05:53:41 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.85 2001/11/21 22:33:14 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -4191,18 +4191,18 @@ SELECT NULLIF(value, '(none)') ...
41914191

41924192
<tbody>
41934193
<row>
4194-
<entry>current_user</>
4195-
<entry>name</>
4194+
<entry><function>current_user</></entry>
4195+
<entry><type>name</></entry>
41964196
<entry>user name of current execution context</>
41974197
</row>
41984198
<row>
4199-
<entry>session_user</>
4200-
<entry>name</>
4199+
<entry><function>session_user</></entry>
4200+
<entry><type>name</></entry>
42014201
<entry>session user name</>
42024202
</row>
42034203
<row>
4204-
<entry>user</>
4205-
<entry>name</>
4204+
<entry><function>user</></entry>
4205+
<entry><type>name</></entry>
42064206
<entry>equivalent to <function>current_user</></>
42074207
</row>
42084208
</tbody>
@@ -4216,7 +4216,7 @@ SELECT NULLIF(value, '(none)') ...
42164216

42174217
<para>
42184218
The <function>session_user</> is the user that initiated a database
4219-
connection and is fixed for the duration of that connection. The
4219+
connection; it is fixed for the duration of that connection. The
42204220
<function>current_user</> is the user identifier that is applicable
42214221
for permission checking. Currently it is always equal to the session
42224222
user, but in the future there might be <quote>setuid</> functions and
@@ -4226,7 +4226,7 @@ SELECT NULLIF(value, '(none)') ...
42264226
</para>
42274227

42284228
<para>
4229-
Note that these functions have special syntactic status in <acronym>SQL</>;
4229+
Note that these functions have special syntactic status in <acronym>SQL</>:
42304230
they must be called without trailing parentheses.
42314231
</para>
42324232

@@ -4238,6 +4238,32 @@ SELECT NULLIF(value, '(none)') ...
42384238
</para>
42394239
</note>
42404240

4241+
<table>
4242+
<title>System Information Functions</>
4243+
<tgroup cols="3">
4244+
<thead>
4245+
<row><entry>Name</> <entry>Return Type</> <entry>Description</></row>
4246+
</thead>
4247+
4248+
<tbody>
4249+
<row>
4250+
<entry><function>version</></entry>
4251+
<entry><type>text</></entry>
4252+
<entry>PostgreSQL version information</>
4253+
</row>
4254+
</tbody>
4255+
</tgroup>
4256+
</table>
4257+
4258+
<indexterm zone="functions-misc">
4259+
<primary>version</primary>
4260+
</indexterm>
4261+
4262+
<para>
4263+
<function>version()</> returns a string describing the PostgreSQL
4264+
server's version.
4265+
</para>
4266+
42414267
<table>
42424268
<title>Access Privilege Inquiry Functions</>
42434269
<tgroup cols="3">
@@ -4272,7 +4298,9 @@ SELECT NULLIF(value, '(none)') ...
42724298
<para>
42734299
<function>has_table_privilege</> determines whether a user
42744300
can access a table in a particular way. The user can be
4275-
specified by name or by ID (<classname>pg_user</>.<structfield>usesysid</>) or if the argument is omitted
4301+
specified by name or by ID
4302+
(<classname>pg_user</>.<structfield>usesysid</>), or if the argument is
4303+
omitted
42764304
<function>current_user</> is assumed. The table can be specified
42774305
by name or by OID. (Thus, there are actually six variants of
42784306
<function>has_table_privilege</>, which can be distinguished by
@@ -4284,29 +4312,61 @@ SELECT NULLIF(value, '(none)') ...
42844312
</para>
42854313

42864314
<table>
4287-
<title>System Information Functions</>
4315+
<title>Catalog Information Functions</>
42884316
<tgroup cols="3">
42894317
<thead>
42904318
<row><entry>Name</> <entry>Return Type</> <entry>Description</></row>
42914319
</thead>
42924320

42934321
<tbody>
42944322
<row>
4295-
<entry>version</>
4296-
<entry>text</>
4297-
<entry>PostgreSQL version information</>
4323+
<entry><function>pg_get_viewdef</>(<parameter>viewname</parameter>)</entry>
4324+
<entry><type>text</></entry>
4325+
<entry>Get CREATE VIEW command for view</>
4326+
</row>
4327+
<row>
4328+
<entry><function>pg_get_ruledef</>(<parameter>rulename</parameter>)</entry>
4329+
<entry><type>text</></entry>
4330+
<entry>Get CREATE RULE command for rule</>
4331+
</row>
4332+
<row>
4333+
<entry><function>pg_get_indexdef</>(<parameter>indexOID</parameter>)</entry>
4334+
<entry><type>text</></entry>
4335+
<entry>Get CREATE INDEX command for index</>
4336+
</row>
4337+
<row>
4338+
<entry><function>pg_get_userbyid</>(<parameter>userid</parameter>)</entry>
4339+
<entry><type>name</></entry>
4340+
<entry>Get user name given sysid</>
42984341
</row>
42994342
</tbody>
43004343
</tgroup>
43014344
</table>
43024345

43034346
<indexterm zone="functions-misc">
4304-
<primary>version</primary>
4347+
<primary>pg_get_viewdef</primary>
4348+
</indexterm>
4349+
4350+
<indexterm zone="functions-misc">
4351+
<primary>pg_get_ruledef</primary>
4352+
</indexterm>
4353+
4354+
<indexterm zone="functions-misc">
4355+
<primary>pg_get_indexdef</primary>
4356+
</indexterm>
4357+
4358+
<indexterm zone="functions-misc">
4359+
<primary>pg_get_userbyid</primary>
43054360
</indexterm>
43064361

43074362
<para>
4308-
<function>version()</> returns a string describing the PostgreSQL
4309-
server's version.
4363+
These functions extract information from the system catalogs.
4364+
<function>pg_get_viewdef()</>, <function>pg_get_ruledef()</>, and
4365+
<function>pg_get_indexdef()</> respectively reconstruct the creating
4366+
command for a view, rule, or index. (Note that this is a decompiled
4367+
reconstruction, not the verbatim text of the command.)
4368+
<function>pg_get_userbyid()</> extracts a user's name given a
4369+
<structfield>usesysid</> value.
43104370
</para>
43114371

43124372
</sect1>

0 commit comments

Comments
 (0)