From a676201490c8113b4692562126c77a29dfd8dac1 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Tue, 30 Dec 2014 15:41:50 -0300 Subject: Add pg_identify_object_as_address This function returns object type and objname/objargs arrays, which can be passed to pg_get_object_address. This is especially useful because the textual representation can be copied to a remote server in order to obtain the corresponding OID-based address. In essence, this function is the inverse of recently added pg_get_object_address(). Catalog version bumped due to the addition of the new function. Also add docs to pg_get_object_address. --- doc/src/sgml/func.sgml | 149 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 106 insertions(+), 43 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 24c64b7187f..53aeb12f9a5 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -15307,14 +15307,6 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); format_type - - pg_describe_object - - - - pg_identify_object - - pg_get_constraintdef @@ -15429,16 +15421,6 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); text get SQL name of a data type - - pg_describe_object(catalog_id, object_id, object_sub_id) - 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 @@ -15707,31 +15689,6 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); pg_class catalogs. - - 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 a 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 @@ -15790,6 +15747,112 @@ SELECT collation for ('foo' COLLATE "de_DE"); the given name matches multiple objects). + + pg_describe_object + + + + pg_identify_object + + + + pg_identify_object_as_address + + + + pg_get_object_address + + + + lists functions related to + database object identification and addressing. + + + + Object Information and Addressing Functions + + + Name Return Type Description + + + + + pg_describe_object(catalog_id, object_id, object_sub_id) + 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_identify_object_as_address(catalog_id oid, object_id oid, object_sub_id integer) + type text, name text[], args text[] + get external representation of a database object's address + + + pg_get_object_address(type text, name text[], args text[]) + catalog_id oid, object_id oid, object_sub_id int32 + get address of a database object, from its external representation + + + +
+ + + 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 a 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_identify_object_as_address 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. The returned + information is independent of the current server, that is, it could be used + to identify an identically named object in another server. + type identifies the type of database object; + name and args are text arrays that together + form a reference to the object. These three columns can be passed to + pg_get_object_address to obtain the internal address + of the object. + This function is the inverse of pg_get_object_address. + + + + pg_get_object_address returns a row containing enough + information to uniquely identify the database object specified by its + type and object name and argument arrays. The returned values are the + ones that would be used in system catalogs such as pg_depend + and can be passed to other system functions such as + pg_identify_object or pg_describe_object. + catalog_id is the OID of the system catalog containing the + object; + object_id is the OID of the object itself, and + object_sub_id is the object sub-ID, or zero if none. + This function is the inverse of pg_identify_object_as_address. + + col_description -- cgit v1.2.3