diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-03-20 18:19:19 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-03-20 18:19:19 -0300 |
commit | f8348ea32ec8d713cd6e5d5e16f15edef22c4d03 (patch) | |
tree | b29bf3aef75a8927e7e9d889bef6786984a058c0 /doc/src | |
parent | a7921f71a3c747141344d8604f6a6d7b4cddb2a9 (diff) | |
download | postgresql-f8348ea32ec8d713cd6e5d5e16f15edef22c4d03.tar.gz postgresql-f8348ea32ec8d713cd6e5d5e16f15edef22c4d03.zip |
Allow extracting machine-readable object identity
Introduce pg_identify_object(oid,oid,int4), which is similar in spirit
to pg_describe_object but instead produces a row of machine-readable
information to uniquely identify the given object, without resorting to
OIDs or other internal representation. This is intended to be used in
the event trigger implementation, to report objects being operated on;
but it has usefulness of its own.
Catalog version bumped because of the new function.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 51df17248a5..490d7106435 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -13931,6 +13931,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); </indexterm> <indexterm> + <primary>pg_identify_object</primary> + </indexterm> + + <indexterm> <primary>pg_get_constraintdef</primary> </indexterm> @@ -14030,6 +14034,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); <entry>get description of a database object</entry> </row> <row> + <entry><literal><function>pg_identify_object(<parameter>catalog_id</parameter> <type>oid</>, <parameter>object_id</parameter> <type>oid</>, <parameter>object_sub_id</parameter> <type>integer</>)</function></literal></entry> + <entry><parameter>type</> <type>text</>, <parameter>schema</> <type>text</>, <parameter>name</> <type>text</>, <parameter>identity</> <type>text</></entry> + <entry>get identity of a database object</entry> + </row> + <row> <entry><literal><function>pg_get_constraintdef(<parameter>constraint_oid</parameter>)</function></literal></entry> <entry><type>text</type></entry> <entry>get definition of a constraint</entry> @@ -14273,13 +14282,31 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); </para> <para> - <function>pg_describe_object</function> returns a description of a database + <function>pg_describe_object</function> returns a textual description of a database object specified by catalog OID, object OID and a (possibly zero) sub-object ID. + This description is intended to be human-readable, and might be translated, + depending on server configuration. This is useful to determine the identity of an object as stored in the <structname>pg_depend</structname> catalog. </para> <para> + <function>pg_identify_object</function> returns a row containing enough information + to uniquely identify the database object specified by catalog OID, object OID and a + (possibly zero) sub-object ID. This information is intended to be machine-readable, + and is never translated. + <parameter>type</> identifies the type of database object; + <parameter>schema</> is the schema name that the object belongs in, or + <literal>NULL</> for object types that do not belong to schemas; + <parameter>name</> is the name of the object, quoted if necessary, only + present if it can be used (alongside schema name, if pertinent) as an unique + identifier of the object, otherwise <literal>NULL</>; + <parameter>identity</> is the complete object identity, with the precise format + depending on object type, and each part within the format being + schema-qualified and quoted as necessary. + </para> + + <para> <function>pg_typeof</function> returns the OID of the data type of the value that is passed to it. This can be helpful for troubleshooting or dynamically constructing SQL queries. The function is declared as |