Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f8348ea

Browse files
committed
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.
1 parent a7921f7 commit f8348ea

File tree

12 files changed

+2140
-954
lines changed

12 files changed

+2140
-954
lines changed

doc/src/sgml/func.sgml

+28-1
Original file line numberDiff line numberDiff line change
@@ -13930,6 +13930,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1393013930
<primary>pg_describe_object</primary>
1393113931
</indexterm>
1393213932

13933+
<indexterm>
13934+
<primary>pg_identify_object</primary>
13935+
</indexterm>
13936+
1393313937
<indexterm>
1393413938
<primary>pg_get_constraintdef</primary>
1393513939
</indexterm>
@@ -14029,6 +14033,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1402914033
<entry><type>text</type></entry>
1403014034
<entry>get description of a database object</entry>
1403114035
</row>
14036+
<row>
14037+
<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>
14038+
<entry><parameter>type</> <type>text</>, <parameter>schema</> <type>text</>, <parameter>name</> <type>text</>, <parameter>identity</> <type>text</></entry>
14039+
<entry>get identity of a database object</entry>
14040+
</row>
1403214041
<row>
1403314042
<entry><literal><function>pg_get_constraintdef(<parameter>constraint_oid</parameter>)</function></literal></entry>
1403414043
<entry><type>text</type></entry>
@@ -14273,12 +14282,30 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1427314282
</para>
1427414283

1427514284
<para>
14276-
<function>pg_describe_object</function> returns a description of a database
14285+
<function>pg_describe_object</function> returns a textual description of a database
1427714286
object specified by catalog OID, object OID and a (possibly zero) sub-object ID.
14287+
This description is intended to be human-readable, and might be translated,
14288+
depending on server configuration.
1427814289
This is useful to determine the identity of an object as stored in the
1427914290
<structname>pg_depend</structname> catalog.
1428014291
</para>
1428114292

14293+
<para>
14294+
<function>pg_identify_object</function> returns a row containing enough information
14295+
to uniquely identify the database object specified by catalog OID, object OID and a
14296+
(possibly zero) sub-object ID. This information is intended to be machine-readable,
14297+
and is never translated.
14298+
<parameter>type</> identifies the type of database object;
14299+
<parameter>schema</> is the schema name that the object belongs in, or
14300+
<literal>NULL</> for object types that do not belong to schemas;
14301+
<parameter>name</> is the name of the object, quoted if necessary, only
14302+
present if it can be used (alongside schema name, if pertinent) as an unique
14303+
identifier of the object, otherwise <literal>NULL</>;
14304+
<parameter>identity</> is the complete object identity, with the precise format
14305+
depending on object type, and each part within the format being
14306+
schema-qualified and quoted as necessary.
14307+
</para>
14308+
1428214309
<para>
1428314310
<function>pg_typeof</function> returns the OID of the data type of the
1428414311
value that is passed to it. This can be helpful for troubleshooting or

0 commit comments

Comments
 (0)