1- <!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.324 2006/07/06 01:46:37 momjian Exp $ -->
1+ <!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.325 2006/07/11 19:11:26 neilc Exp $ -->
22
33 <chapter id="functions">
44 <title>Functions and Operators</title>
@@ -9496,34 +9496,26 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
94969496 <entry>get SQL name of a data type</entry>
94979497 </row>
94989498 <row>
9499- <entry><literal><function>pg_get_viewdef</function>(<parameter>view_name</parameter>)</literal></entry>
9500- <entry><type>text</type></entry>
9501- <entry>get <command>CREATE VIEW</> command for view (<emphasis>deprecated</emphasis>)</entry>
9502- </row>
9503- <row>
9504- <entry><literal><function>pg_get_viewdef</function>(<parameter>view_name</parameter>, <parameter>pretty_bool</>)</literal></entry>
9505- <entry><type>text</type></entry>
9506- <entry>get <command>CREATE VIEW</> command for view (<emphasis>deprecated</emphasis>)</entry>
9507- </row>
9508- <row>
9509- <entry><literal><function>pg_get_viewdef</function>(<parameter>view_oid</parameter>)</literal></entry>
9499+ <entry><literal><function>pg_get_constraintdef</function>(<parameter>constraint_oid</parameter>)</literal></entry>
95109500 <entry><type>text</type></entry>
9511- <entry>get<command>CREATE VIEW</> command for view </entry>
9501+ <entry>getdefinition of a constraint </entry>
95129502 </row>
95139503 <row>
9514- <entry><literal><function>pg_get_viewdef </function>(<parameter>view_oid </parameter>, <parameter>pretty_bool</>)</literal></entry>
9504+ <entry><literal><function>pg_get_constraintdef </function>(<parameter>constraint_oid </parameter>, <parameter>pretty_bool</>)</literal></entry>
95159505 <entry><type>text</type></entry>
9516- <entry>get<command>CREATE VIEW</> command for view </entry>
9506+ <entry>getdefinition of a constraint </entry>
95179507 </row>
95189508 <row>
9519- <entry><literal><function>pg_get_ruledef </function>(<parameter>rule_oid </parameter>)</literal></entry>
9509+ <entry><literal><function>pg_get_expr </function>(<parameter>expr_text </parameter>, <parameter>relation_oid</ >)</literal></entry>
95209510 <entry><type>text</type></entry>
9521- <entry>get <command>CREATE RULE</> command for rule</entry>
9511+ <entry>decompile internal form of an expression, assuming that any Vars
9512+ in it refer to the relation indicated by the second parameter</entry>
95229513 </row>
95239514 <row>
9524- <entry><literal><function>pg_get_ruledef </function>(<parameter>rule_oid </parameter>, <parameter>pretty_bool</>)</literal></entry>
9515+ <entry><literal><function>pg_get_expr </function>(<parameter>expr_text </parameter>, <parameter>relation_oid</ >, <parameter>pretty_bool</>)</literal></entry>
95259516 <entry><type>text</type></entry>
9526- <entry>get <command>CREATE RULE</> command for rule</entry>
9517+ <entry>decompile internal form of an expression, assuming that any Vars
9518+ in it refer to the relation indicated by the second parameter</entry>
95279519 </row>
95289520 <row>
95299521 <entry><literal><function>pg_get_indexdef</function>(<parameter>index_oid</parameter>)</literal></entry>
@@ -9538,47 +9530,55 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
95389530 <parameter>column_no</> is not zero</entry>
95399531 </row>
95409532 <row>
9541- <entry><function>pg_get_triggerdef </function>(<parameter>trigger_oid </parameter>)</entry>
9533+ <entry><literal>< function>pg_get_ruledef </function>(<parameter>rule_oid </parameter>)</literal> </entry>
95429534 <entry><type>text</type></entry>
9543- <entry>get <command>CREATE[ CONSTRAINT ] TRIGGER </> command fortrigger </entry>
9535+ <entry>get <command>CREATERULE </> command forrule </entry>
95449536 </row>
95459537 <row>
9546- <entry><literal><function>pg_get_constraintdef </function>(<parameter>constraint_oid </parameter>)</literal></entry>
9538+ <entry><literal><function>pg_get_ruledef </function>(<parameter>rule_oid </parameter>, <parameter>pretty_bool</ >)</literal></entry>
95479539 <entry><type>text</type></entry>
9548- <entry>getdefinition of a constraint </entry>
9540+ <entry>get<command>CREATE RULE</> command for rule </entry>
95499541 </row>
95509542 <row>
9551- <entry><literal><function>pg_get_constraintdef </function>(<parameter>constraint_oid </parameter>, <parameter>pretty_bool</ >)</literal></entry>
9543+ <entry><literal><function>pg_get_serial_sequence </function>(<parameter>table_name </parameter>, <parameter>column_name</parameter >)</literal></entry>
95529544 <entry><type>text</type></entry>
9553- <entry>get definition of a constraint</entry>
9545+ <entry>get name of the sequence that a <type>serial</type> or <type>bigserial</type> column
9546+ uses</entry>
95549547 </row>
95559548 <row>
9556- <entry><literal><function>pg_get_expr</function>(<parameter>expr_text</parameter>, <parameter>relation_oid</>)</literal></entry>
9557- <entry><type>text</type></entry>
9558- <entry>decompile internal form of an expression, assuming that any Vars
9559- in it refer to the relation indicated by the second parameter</entry>
9549+ <entry><literal><function>pg_tablespace_databases</function>(<parameter>tablespace_oid</parameter>)</literal></entry>
9550+ <entry><type>setof oid</type></entry>
9551+ <entry>get the set of database OIDs that have objects in the tablespace</entry>
95609552 </row>
95619553 <row>
9562- <entry><literal>< function>pg_get_expr </function>(<parameter>expr_text </parameter>, <parameter>relation_oid</>, <parameter>pretty_bool</>)</literal> </entry>
9554+ <entry><function>pg_get_triggerdef </function>(<parameter>trigger_oid </parameter>) </entry>
95639555 <entry><type>text</type></entry>
9564- <entry>decompile internal form of an expression, assuming that any Vars
9565- in it refer to the relation indicated by the second parameter</entry>
9556+ <entry>get <command>CREATE [ CONSTRAINT ] TRIGGER</> command for trigger</entry>
95669557 </row>
95679558 <row>
95689559 <entry><literal><function>pg_get_userbyid</function>(<parameter>roleid</parameter>)</literal></entry>
95699560 <entry><type>name</type></entry>
95709561 <entry>get role name with given ID</entry>
95719562 </row>
95729563 <row>
9573- <entry><literal><function>pg_get_serial_sequence </function>(<parameter>table_name</parameter>, <parameter>column_name </parameter>)</literal></entry>
9564+ <entry><literal><function>pg_get_viewdef </function>(<parameter>view_name </parameter>)</literal></entry>
95749565 <entry><type>text</type></entry>
9575- <entry>get name of the sequence that a <type>serial</type> or <type>bigserial</type> column
9576- uses</entry>
9566+ <entry>get underlying <command>SELECT</command> command for view (<emphasis>deprecated</emphasis>)</entry>
95779567 </row>
95789568 <row>
9579- <entry><literal><function>pg_tablespace_databases</function>(<parameter>tablespace_oid</parameter>)</literal></entry>
9580- <entry><type>setof oid</type></entry>
9581- <entry>get the set of database OIDs that have objects in the tablespace</entry>
9569+ <entry><literal><function>pg_get_viewdef</function>(<parameter>view_name</parameter>, <parameter>pretty_bool</>)</literal></entry>
9570+ <entry><type>text</type></entry>
9571+ <entry>get underlying <command>SELECT</command> command for view (<emphasis>deprecated</emphasis>)</entry>
9572+ </row>
9573+ <row>
9574+ <entry><literal><function>pg_get_viewdef</function>(<parameter>view_oid</parameter>)</literal></entry>
9575+ <entry><type>text</type></entry>
9576+ <entry>get underlying <command>SELECT</command> command for view</entry>
9577+ </row>
9578+ <row>
9579+ <entry><literal><function>pg_get_viewdef</function>(<parameter>view_oid</parameter>, <parameter>pretty_bool</>)</literal></entry>
9580+ <entry><type>text</type></entry>
9581+ <entry>get underlying <command>SELECT</command> command for view</entry>
95829582 </row>
95839583 </tbody>
95849584 </tgroup>
@@ -9591,30 +9591,22 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
95919591 </para>
95929592
95939593 <para>
9594- <function>pg_get_viewdef</function>,
9595- <function>pg_get_ruledef</function>,
9596- <function>pg_get_indexdef</function>,
9597- <function>pg_get_triggerdef</function>, and
9598- <function>pg_get_constraintdef</function> respectively
9599- reconstruct the creating command for a view, rule, index, trigger, or
9600- constraint. (Note that this is a decompiled reconstruction, not
9601- the original text of the command.)
9594+ <function>pg_get_constraintdef</function>,
9595+ <function>pg_get_indexdef</function>, <function>pg_get_ruledef</function>,
9596+ and <function>pg_get_triggerdef</function>, respectively reconstruct the
9597+ creating command for a constraint, index, rule, or trigger. (Note that this
9598+ is a decompiled reconstruction, not the original text of the command.)
96029599 <function>pg_get_expr</function> decompiles the internal form of an
9603- individual expression, such as the default value for a column. It
9604- may be useful when examining the contents of system catalogs.
9605- Most of these functions come in two
9606- variants, one of which can optionally <quote>pretty-print</> the result.
9607- The pretty-printed format is more readable, but the default format is more
9608- likely to be
9609- interpreted the same way by future versions of <productname>PostgreSQL</>;
9610- avoid using pretty-printed output for dump purposes.
9611- Passing <literal>false</> for the pretty-print parameter yields the
9612- same result as the variant that does not have the parameter at all.
9613- </para>
9614-
9615- <para>
9616- <function>pg_get_userbyid</function> extracts a role's name given
9617- its OID.
9600+ individual expression, such as the default value for a column. It may be
9601+ useful when examining the contents of system catalogs.
9602+ <function>pg_get_viewdef</function> reconstructs the <command>SELECT</>
9603+ query that defines a view. Most of these functions come in two variants,
9604+ one of which can optionally <quote>pretty-print</> the result. The
9605+ pretty-printed format is more readable, but the default format is more
9606+ likely to be interpreted the same way by future versions of
9607+ <productname>PostgreSQL</>; avoid using pretty-printed output for dump
9608+ purposes. Passing <literal>false</> for the pretty-print parameter yields
9609+ the same result as the variant that does not have the parameter at all.
96189610 </para>
96199611
96209612 <para>
@@ -9626,14 +9618,18 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
96269618 </para>
96279619
96289620 <para>
9629- <function>pg_tablespace_databases</function> allows a tablespace to
9630- be examined. It returns the set of OIDs of databases that have objects
9631- stored in the tablespace. If this function returns any rows, the
9632- tablespace is not empty and cannot be dropped. To
9633- display the specific objects populating the tablespace, you will need
9634- to connect to the databases identified by
9635- <function>pg_tablespace_databases</function> and query their
9636- <structname>pg_class</> catalogs.
9621+ <function>pg_tablespace_databases</function> allows a tablespace to be
9622+ examined. It returns the set of OIDs of databases that have objects stored
9623+ in the tablespace. If this function returns any rows, the tablespace is not
9624+ empty and cannot be dropped. To display the specific objects populating the
9625+ tablespace, you will need to connect to the databases identified by
9626+ <function>pg_tablespace_databases</function> and query their
9627+ <structname>pg_class</> catalogs.
9628+ </para>
9629+
9630+ <para>
9631+ <function>pg_get_userbyid</function> extracts a role's name given
9632+ its OID.
96379633 </para>
96389634
96399635 <indexterm zone="functions-info">