From f8348ea32ec8d713cd6e5d5e16f15edef22c4d03 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 20 Mar 2013 18:19:19 -0300 Subject: 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. --- doc/src/sgml/func.sgml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'doc/src') 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 @@ -13930,6 +13930,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); pg_describe_object + + pg_identify_object + + pg_get_constraintdef @@ -14029,6 +14033,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); text get description of a database object + + pg_identify_object(catalog_id oid, object_id oid, object_sub_id integer) + type text, schema text, name text, identity text + get identity of a database object + pg_get_constraintdef(constraint_oid) text @@ -14273,12 +14282,30 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); - pg_describe_object returns a description of a database + pg_describe_object 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 pg_depend catalog. + + pg_identify_object 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. + type identifies the type of database object; + schema is the schema name that the object belongs in, or + NULL for object types that do not belong to schemas; + 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 NULL; + 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. + + pg_typeof returns the OID of the data type of the value that is passed to it. This can be helpful for troubleshooting or -- cgit v1.2.3