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 $ -->
2
2
3
3
<chapter id="functions">
4
4
<title>Functions and Operators</title>
@@ -9496,34 +9496,26 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
9496
9496
<entry>get SQL name of a data type</entry>
9497
9497
</row>
9498
9498
<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>
9510
9500
<entry><type>text</type></entry>
9511
- <entry>get <command>CREATE VIEW</> command for view </entry>
9501
+ <entry>get definition of a constraint </entry>
9512
9502
</row>
9513
9503
<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>
9515
9505
<entry><type>text</type></entry>
9516
- <entry>get <command>CREATE VIEW</> command for view </entry>
9506
+ <entry>get definition of a constraint </entry>
9517
9507
</row>
9518
9508
<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>
9520
9510
<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>
9522
9513
</row>
9523
9514
<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>
9525
9516
<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>
9527
9519
</row>
9528
9520
<row>
9529
9521
<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);
9538
9530
<parameter>column_no</> is not zero</entry>
9539
9531
</row>
9540
9532
<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>
9542
9534
<entry><type>text</type></entry>
9543
- <entry>get <command>CREATE [ CONSTRAINT ] TRIGGER </> command for trigger </entry>
9535
+ <entry>get <command>CREATE RULE </> command for rule </entry>
9544
9536
</row>
9545
9537
<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>
9547
9539
<entry><type>text</type></entry>
9548
- <entry>get definition of a constraint </entry>
9540
+ <entry>get <command>CREATE RULE</> command for rule </entry>
9549
9541
</row>
9550
9542
<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>
9552
9544
<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>
9554
9547
</row>
9555
9548
<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>
9560
9552
</row>
9561
9553
<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>
9563
9555
<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>
9566
9557
</row>
9567
9558
<row>
9568
9559
<entry><literal><function>pg_get_userbyid</function>(<parameter>roleid</parameter>)</literal></entry>
9569
9560
<entry><type>name</type></entry>
9570
9561
<entry>get role name with given ID</entry>
9571
9562
</row>
9572
9563
<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>
9574
9565
<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>
9577
9567
</row>
9578
9568
<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>
9582
9582
</row>
9583
9583
</tbody>
9584
9584
</tgroup>
@@ -9591,30 +9591,22 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
9591
9591
</para>
9592
9592
9593
9593
<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.)
9602
9599
<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.
9618
9610
</para>
9619
9611
9620
9612
<para>
@@ -9626,14 +9618,18 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
9626
9618
</para>
9627
9619
9628
9620
<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.
9637
9633
</para>
9638
9634
9639
9635
<indexterm zone="functions-info">
0 commit comments