Commit cf3b164a authored by Tom Lane's avatar Tom Lane

Add documentation for pg_get_ruledef and friends.

parent a157385d
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.84 2001/11/21 05:53:41 thomas Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.85 2001/11/21 22:33:14 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -4191,18 +4191,18 @@ SELECT NULLIF(value, '(none)') ... ...@@ -4191,18 +4191,18 @@ SELECT NULLIF(value, '(none)') ...
<tbody> <tbody>
<row> <row>
<entry>current_user</> <entry><function>current_user</></entry>
<entry>name</> <entry><type>name</></entry>
<entry>user name of current execution context</> <entry>user name of current execution context</>
</row> </row>
<row> <row>
<entry>session_user</> <entry><function>session_user</></entry>
<entry>name</> <entry><type>name</></entry>
<entry>session user name</> <entry>session user name</>
</row> </row>
<row> <row>
<entry>user</> <entry><function>user</></entry>
<entry>name</> <entry><type>name</></entry>
<entry>equivalent to <function>current_user</></> <entry>equivalent to <function>current_user</></>
</row> </row>
</tbody> </tbody>
...@@ -4216,7 +4216,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -4216,7 +4216,7 @@ SELECT NULLIF(value, '(none)') ...
<para> <para>
The <function>session_user</> is the user that initiated a database The <function>session_user</> is the user that initiated a database
connection and is fixed for the duration of that connection. The connection; it is fixed for the duration of that connection. The
<function>current_user</> is the user identifier that is applicable <function>current_user</> is the user identifier that is applicable
for permission checking. Currently it is always equal to the session for permission checking. Currently it is always equal to the session
user, but in the future there might be <quote>setuid</> functions and user, but in the future there might be <quote>setuid</> functions and
...@@ -4226,7 +4226,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -4226,7 +4226,7 @@ SELECT NULLIF(value, '(none)') ...
</para> </para>
<para> <para>
Note that these functions have special syntactic status in <acronym>SQL</>; Note that these functions have special syntactic status in <acronym>SQL</>:
they must be called without trailing parentheses. they must be called without trailing parentheses.
</para> </para>
...@@ -4238,6 +4238,32 @@ SELECT NULLIF(value, '(none)') ... ...@@ -4238,6 +4238,32 @@ SELECT NULLIF(value, '(none)') ...
</para> </para>
</note> </note>
<table>
<title>System Information Functions</>
<tgroup cols="3">
<thead>
<row><entry>Name</> <entry>Return Type</> <entry>Description</></row>
</thead>
<tbody>
<row>
<entry><function>version</></entry>
<entry><type>text</></entry>
<entry>PostgreSQL version information</>
</row>
</tbody>
</tgroup>
</table>
<indexterm zone="functions-misc">
<primary>version</primary>
</indexterm>
<para>
<function>version()</> returns a string describing the PostgreSQL
server's version.
</para>
<table> <table>
<title>Access Privilege Inquiry Functions</> <title>Access Privilege Inquiry Functions</>
<tgroup cols="3"> <tgroup cols="3">
...@@ -4272,7 +4298,9 @@ SELECT NULLIF(value, '(none)') ... ...@@ -4272,7 +4298,9 @@ SELECT NULLIF(value, '(none)') ...
<para> <para>
<function>has_table_privilege</> determines whether a user <function>has_table_privilege</> determines whether a user
can access a table in a particular way. The user can be can access a table in a particular way. The user can be
specified by name or by ID (<classname>pg_user</>.<structfield>usesysid</>) or if the argument is omitted specified by name or by ID
(<classname>pg_user</>.<structfield>usesysid</>), or if the argument is
omitted
<function>current_user</> is assumed. The table can be specified <function>current_user</> is assumed. The table can be specified
by name or by OID. (Thus, there are actually six variants of by name or by OID. (Thus, there are actually six variants of
<function>has_table_privilege</>, which can be distinguished by <function>has_table_privilege</>, which can be distinguished by
...@@ -4284,7 +4312,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -4284,7 +4312,7 @@ SELECT NULLIF(value, '(none)') ...
</para> </para>
<table> <table>
<title>System Information Functions</> <title>Catalog Information Functions</>
<tgroup cols="3"> <tgroup cols="3">
<thead> <thead>
<row><entry>Name</> <entry>Return Type</> <entry>Description</></row> <row><entry>Name</> <entry>Return Type</> <entry>Description</></row>
...@@ -4292,21 +4320,53 @@ SELECT NULLIF(value, '(none)') ... ...@@ -4292,21 +4320,53 @@ SELECT NULLIF(value, '(none)') ...
<tbody> <tbody>
<row> <row>
<entry>version</> <entry><function>pg_get_viewdef</>(<parameter>viewname</parameter>)</entry>
<entry>text</> <entry><type>text</></entry>
<entry>PostgreSQL version information</> <entry>Get CREATE VIEW command for view</>
</row>
<row>
<entry><function>pg_get_ruledef</>(<parameter>rulename</parameter>)</entry>
<entry><type>text</></entry>
<entry>Get CREATE RULE command for rule</>
</row>
<row>
<entry><function>pg_get_indexdef</>(<parameter>indexOID</parameter>)</entry>
<entry><type>text</></entry>
<entry>Get CREATE INDEX command for index</>
</row>
<row>
<entry><function>pg_get_userbyid</>(<parameter>userid</parameter>)</entry>
<entry><type>name</></entry>
<entry>Get user name given sysid</>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
<indexterm zone="functions-misc"> <indexterm zone="functions-misc">
<primary>version</primary> <primary>pg_get_viewdef</primary>
</indexterm>
<indexterm zone="functions-misc">
<primary>pg_get_ruledef</primary>
</indexterm>
<indexterm zone="functions-misc">
<primary>pg_get_indexdef</primary>
</indexterm>
<indexterm zone="functions-misc">
<primary>pg_get_userbyid</primary>
</indexterm> </indexterm>
<para> <para>
<function>version()</> returns a string describing the PostgreSQL These functions extract information from the system catalogs.
server's version. <function>pg_get_viewdef()</>, <function>pg_get_ruledef()</>, and
<function>pg_get_indexdef()</> respectively reconstruct the creating
command for a view, rule, or index. (Note that this is a decompiled
reconstruction, not the verbatim text of the command.)
<function>pg_get_userbyid()</> extracts a user's name given a
<structfield>usesysid</> value.
</para> </para>
</sect1> </sect1>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment