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

Commit52347b6

Browse files
committed
Add pretty-printing variants of pg_get_viewdef and related functions.
Patch from Andreas Pflug.
1 parent12911ea commit52347b6

File tree

5 files changed

+951
-193
lines changed

5 files changed

+951
-193
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 57 additions & 6 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.161 2003/07/29 00:03:17 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.162 2003/07/30 22:56:23 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -6494,10 +6494,9 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
64946494

64956495
<para>
64966496
The function <function>current_setting</function> yields the
6497-
current value of the setting <parameter>setting_name</parameter>,
6498-
as part of a query result. It corresponds to the
6499-
<acronym>SQL</acronym> command <command>SHOW</command>. An
6500-
example:
6497+
current value of the setting <parameter>setting_name</parameter>.
6498+
It corresponds to the <acronym>SQL</acronym> command
6499+
<command>SHOW</command>. An example:
65016500
<programlisting>
65026501
SELECT current_setting('datestyle');
65036502

@@ -6832,6 +6831,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
68326831
<primary>pg_get_constraintdef</primary>
68336832
</indexterm>
68346833

6834+
<indexterm zone="functions-misc">
6835+
<primary>pg_get_expr</primary>
6836+
</indexterm>
6837+
68356838
<indexterm zone="functions-misc">
68366839
<primary>pg_get_userbyid</primary>
68376840
</indexterm>
@@ -6846,7 +6849,16 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
68466849
<function>pg_get_constraintdef</function> respectively
68476850
reconstruct the creating command for a view, rule, index, or
68486851
constraint. (Note that this is a decompiled reconstruction, not
6849-
the verbatim text of the command.)
6852+
the original text of the command.) Most of these come in two
6853+
variants, one of which can optionally <quote>pretty-print</> the result.
6854+
The pretty-printed form is more readable but is less likely to be
6855+
interpreted the same way by future versions of <productname>PostgreSQL</>;
6856+
avoid using pretty-printed output for dump purposes.
6857+
Passing <literal>false</> for the pretty-print parameter yields the
6858+
same result as the variant that does not have the parameter at all.
6859+
<function>pg_get_expr</function> decompiles the internal form of an
6860+
individual expression, such as the default value for a column. It
6861+
may be useful when examining the contents of system catalogs.
68506862
<function>pg_get_userbyid</function>
68516863
extracts a user's name given a user ID number.
68526864
</para>
@@ -6864,21 +6876,43 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
68646876
<entry><type>text</type></entry>
68656877
<entry>get <command>CREATE VIEW</> command for view (<emphasis>deprecated</emphasis>)</entry>
68666878
</row>
6879+
<row>
6880+
<entry><literal><function>pg_get_viewdef</function>(<parameter>view_name</parameter>, <parameter>pretty_bool</>)</literal></entry>
6881+
<entry><type>text</type></entry>
6882+
<entry>get <command>CREATE VIEW</> command for view (<emphasis>deprecated</emphasis>)</entry>
6883+
</row>
68676884
<row>
68686885
<entry><literal><function>pg_get_viewdef</function>(<parameter>view_oid</parameter>)</literal></entry>
68696886
<entry><type>text</type></entry>
68706887
<entry>get <command>CREATE VIEW</> command for view</entry>
68716888
</row>
6889+
<row>
6890+
<entry><literal><function>pg_get_viewdef</function>(<parameter>view_oid</parameter>, <parameter>pretty_bool</>)</literal></entry>
6891+
<entry><type>text</type></entry>
6892+
<entry>get <command>CREATE VIEW</> command for view</entry>
6893+
</row>
68726894
<row>
68736895
<entry><literal><function>pg_get_ruledef</function>(<parameter>rule_oid</parameter>)</literal></entry>
68746896
<entry><type>text</type></entry>
68756897
<entry>get <command>CREATE RULE</> command for rule</entry>
68766898
</row>
6899+
<row>
6900+
<entry><literal><function>pg_get_ruledef</function>(<parameter>rule_oid</parameter>, <parameter>pretty_bool</>)</literal></entry>
6901+
<entry><type>text</type></entry>
6902+
<entry>get <command>CREATE RULE</> command for rule</entry>
6903+
</row>
68776904
<row>
68786905
<entry><literal><function>pg_get_indexdef</function>(<parameter>index_oid</parameter>)</literal></entry>
68796906
<entry><type>text</type></entry>
68806907
<entry>get <command>CREATE INDEX</> command for index</entry>
68816908
</row>
6909+
<row>
6910+
<entry><literal><function>pg_get_indexdef</function>(<parameter>index_oid</parameter>, <parameter>column_no</>, <parameter>pretty_bool</>)</literal></entry>
6911+
<entry><type>text</type></entry>
6912+
<entry>get <command>CREATE INDEX</> command for index,
6913+
or definition of just one index column when
6914+
<parameter>column_no</> is not zero</entry>
6915+
</row>
68826916
<row>
68836917
<entry><function>pg_get_triggerdef</function>(<parameter>trigger_oid</parameter>)</entry>
68846918
<entry><type>text</type></entry>
@@ -6889,6 +6923,23 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
68896923
<entry><type>text</type></entry>
68906924
<entry>get definition of a constraint</entry>
68916925
</row>
6926+
<row>
6927+
<entry><literal><function>pg_get_constraintdef</function>(<parameter>constraint_oid</parameter>, <parameter>pretty_bool</>)</literal></entry>
6928+
<entry><type>text</type></entry>
6929+
<entry>get definition of a constraint</entry>
6930+
</row>
6931+
<row>
6932+
<entry><literal><function>pg_get_expr</function>(<parameter>expr_text</parameter>, <parameter>relation_oid</>)</literal></entry>
6933+
<entry><type>text</type></entry>
6934+
<entry>decompile internal form of an expression, assuming that any Vars
6935+
in it refer to the relation indicated by the second parameter</entry>
6936+
</row>
6937+
<row>
6938+
<entry><literal><function>pg_get_expr</function>(<parameter>expr_text</parameter>, <parameter>relation_oid</>, <parameter>pretty_bool</>)</literal></entry>
6939+
<entry><type>text</type></entry>
6940+
<entry>decompile internal form of an expression, assuming that any Vars
6941+
in it refer to the relation indicated by the second parameter</entry>
6942+
</row>
68926943
<row>
68936944
<entry><literal><function>pg_get_userbyid</function>(<parameter>userid</parameter>)</literal></entry>
68946945
<entry><type>name</type></entry>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp