From 52347b66370988e55b5b55d78d54ec8f13d1123b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 30 Jul 2003 22:56:24 +0000 Subject: Add pretty-printing variants of pg_get_viewdef and related functions. Patch from Andreas Pflug. --- doc/src/sgml/func.sgml | 63 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 6 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index d5a528e1c38..dc06faacbb4 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ @@ -6494,10 +6494,9 @@ SET search_path TO schema , schema, .. The function current_setting yields the - current value of the setting setting_name, - as part of a query result. It corresponds to the - SQL command SHOW. An - example: + current value of the setting setting_name. + It corresponds to the SQL command + SHOW. An example: SELECT current_setting('datestyle'); @@ -6832,6 +6831,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); pg_get_constraintdef + + pg_get_expr + + pg_get_userbyid @@ -6846,7 +6849,16 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); pg_get_constraintdef respectively reconstruct the creating command for a view, rule, index, or constraint. (Note that this is a decompiled reconstruction, not - the verbatim text of the command.) + the original text of the command.) Most of these come in two + variants, one of which can optionally pretty-print the result. + The pretty-printed form is more readable but is less likely to be + interpreted the same way by future versions of PostgreSQL; + avoid using pretty-printed output for dump purposes. + Passing false for the pretty-print parameter yields the + same result as the variant that does not have the parameter at all. + pg_get_expr decompiles the internal form of an + individual expression, such as the default value for a column. It + may be useful when examining the contents of system catalogs. pg_get_userbyid extracts a user's name given a user ID number. @@ -6864,21 +6876,43 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); text get CREATE VIEW command for view (deprecated) + + pg_get_viewdef(view_name, pretty_bool) + text + get CREATE VIEW command for view (deprecated) + pg_get_viewdef(view_oid) text get CREATE VIEW command for view + + pg_get_viewdef(view_oid, pretty_bool) + text + get CREATE VIEW command for view + pg_get_ruledef(rule_oid) text get CREATE RULE command for rule + + pg_get_ruledef(rule_oid, pretty_bool) + text + get CREATE RULE command for rule + pg_get_indexdef(index_oid) text get CREATE INDEX command for index + + pg_get_indexdef(index_oid, column_no, pretty_bool) + text + get CREATE INDEX command for index, + or definition of just one index column when + column_no is not zero + pg_get_triggerdef(trigger_oid) text @@ -6889,6 +6923,23 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); text get definition of a constraint + + pg_get_constraintdef(constraint_oid, pretty_bool) + text + get definition of a constraint + + + pg_get_expr(expr_text, relation_oid) + text + decompile internal form of an expression, assuming that any Vars + in it refer to the relation indicated by the second parameter + + + pg_get_expr(expr_text, relation_oid, pretty_bool) + text + decompile internal form of an expression, assuming that any Vars + in it refer to the relation indicated by the second parameter + pg_get_userbyid(userid) name -- cgit v1.2.3