Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita676201

Browse files
committed
Add pg_identify_object_as_address
This function returns object type and objname/objargs arrays, which canbe passed to pg_get_object_address. This is especially useful becausethe textual representation can be copied to a remote server in order toobtain the corresponding OID-based address. In essence, this functionis 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.
1 parent5b447ad commita676201

File tree

9 files changed

+485
-107
lines changed

9 files changed

+485
-107
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 106 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15307,14 +15307,6 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1530715307
<primary>format_type</primary>
1530815308
</indexterm>
1530915309

15310-
<indexterm>
15311-
<primary>pg_describe_object</primary>
15312-
</indexterm>
15313-
15314-
<indexterm>
15315-
<primary>pg_identify_object</primary>
15316-
</indexterm>
15317-
1531815310
<indexterm>
1531915311
<primary>pg_get_constraintdef</primary>
1532015312
</indexterm>
@@ -15429,16 +15421,6 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1542915421
<entry><type>text</type></entry>
1543015422
<entry>get SQL name of a data type</entry>
1543115423
</row>
15432-
<row>
15433-
<entry><literal><function>pg_describe_object(<parameter>catalog_id</parameter>, <parameter>object_id</parameter>, <parameter>object_sub_id</parameter>)</function></literal></entry>
15434-
<entry><type>text</type></entry>
15435-
<entry>get description of a database object</entry>
15436-
</row>
15437-
<row>
15438-
<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>
15439-
<entry><parameter>type</> <type>text</>, <parameter>schema</> <type>text</>, <parameter>name</> <type>text</>, <parameter>identity</> <type>text</></entry>
15440-
<entry>get identity of a database object</entry>
15441-
</row>
1544215424
<row>
1544315425
<entry><literal><function>pg_get_constraintdef(<parameter>constraint_oid</parameter>)</function></literal></entry>
1544415426
<entry><type>text</type></entry>
@@ -15707,31 +15689,6 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1570715689
<structname>pg_class</> catalogs.
1570815690
</para>
1570915691

15710-
<para>
15711-
<function>pg_describe_object</function> returns a textual description of a database
15712-
object specified by catalog OID, object OID and a (possibly zero) sub-object ID.
15713-
This description is intended to be human-readable, and might be translated,
15714-
depending on server configuration.
15715-
This is useful to determine the identity of an object as stored in the
15716-
<structname>pg_depend</structname> catalog.
15717-
</para>
15718-
15719-
<para>
15720-
<function>pg_identify_object</function> returns a row containing enough information
15721-
to uniquely identify the database object specified by catalog OID, object OID and a
15722-
(possibly zero) sub-object ID. This information is intended to be machine-readable,
15723-
and is never translated.
15724-
<parameter>type</> identifies the type of database object;
15725-
<parameter>schema</> is the schema name that the object belongs in, or
15726-
<literal>NULL</> for object types that do not belong to schemas;
15727-
<parameter>name</> is the name of the object, quoted if necessary, only
15728-
present if it can be used (alongside schema name, if pertinent) as a unique
15729-
identifier of the object, otherwise <literal>NULL</>;
15730-
<parameter>identity</> is the complete object identity, with the precise format
15731-
depending on object type, and each part within the format being
15732-
schema-qualified and quoted as necessary.
15733-
</para>
15734-
1573515692
<para>
1573615693
<function>pg_typeof</function> returns the OID of the data type of the
1573715694
value that is passed to it. This can be helpful for troubleshooting or
@@ -15790,6 +15747,112 @@ SELECT collation for ('foo' COLLATE "de_DE");
1579015747
the given name matches multiple objects).
1579115748
</para>
1579215749

15750+
<indexterm>
15751+
<primary>pg_describe_object</primary>
15752+
</indexterm>
15753+
15754+
<indexterm>
15755+
<primary>pg_identify_object</primary>
15756+
</indexterm>
15757+
15758+
<indexterm>
15759+
<primary>pg_identify_object_as_address</primary>
15760+
</indexterm>
15761+
15762+
<indexterm>
15763+
<primary>pg_get_object_address</primary>
15764+
</indexterm>
15765+
15766+
<para>
15767+
<xref linkend="functions-info-object-table"> lists functions related to
15768+
database object identification and addressing.
15769+
</para>
15770+
15771+
<table id="functions-info-object-table">
15772+
<title>Object Information and Addressing Functions</title>
15773+
<tgroup cols="3">
15774+
<thead>
15775+
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry></row>
15776+
</thead>
15777+
15778+
<tbody>
15779+
<row>
15780+
<entry><literal><function>pg_describe_object(<parameter>catalog_id</parameter>, <parameter>object_id</parameter>, <parameter>object_sub_id</parameter>)</function></literal></entry>
15781+
<entry><type>text</type></entry>
15782+
<entry>get description of a database object</entry>
15783+
</row>
15784+
<row>
15785+
<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>
15786+
<entry><parameter>type</> <type>text</>, <parameter>schema</> <type>text</>, <parameter>name</> <type>text</>, <parameter>identity</> <type>text</></entry>
15787+
<entry>get identity of a database object</entry>
15788+
</row>
15789+
<row>
15790+
<entry><literal><function>pg_identify_object_as_address(<parameter>catalog_id</parameter> <type>oid</>, <parameter>object_id</parameter> <type>oid</>, <parameter>object_sub_id</parameter> <type>integer</>)</function></literal></entry>
15791+
<entry><parameter>type</> <type>text</>, <parameter>name</> <type>text[]</>, <parameter>args</> <type>text[]</></entry>
15792+
<entry>get external representation of a database object's address</entry>
15793+
</row>
15794+
<row>
15795+
<entry><literal><function>pg_get_object_address(<parameter>type</parameter> <type>text</>, <parameter>name</parameter> <type>text[]</>, <parameter>args</parameter> <type>text[]</>)</function></literal></entry>
15796+
<entry><parameter>catalog_id</> <type>oid</>, <parameter>object_id</> <type>oid</>, <parameter>object_sub_id</> <type>int32</></entry>
15797+
<entry>get address of a database object, from its external representation</entry>
15798+
</row>
15799+
</tbody>
15800+
</tgroup>
15801+
</table>
15802+
15803+
<para>
15804+
<function>pg_describe_object</function> returns a textual description of a database
15805+
object specified by catalog OID, object OID and a (possibly zero) sub-object ID.
15806+
This description is intended to be human-readable, and might be translated,
15807+
depending on server configuration.
15808+
This is useful to determine the identity of an object as stored in the
15809+
<structname>pg_depend</structname> catalog.
15810+
</para>
15811+
15812+
<para>
15813+
<function>pg_identify_object</function> returns a row containing enough information
15814+
to uniquely identify the database object specified by catalog OID, object OID and a
15815+
(possibly zero) sub-object ID. This information is intended to be machine-readable,
15816+
and is never translated.
15817+
<parameter>type</> identifies the type of database object;
15818+
<parameter>schema</> is the schema name that the object belongs in, or
15819+
<literal>NULL</> for object types that do not belong to schemas;
15820+
<parameter>name</> is the name of the object, quoted if necessary, only
15821+
present if it can be used (alongside schema name, if pertinent) as a unique
15822+
identifier of the object, otherwise <literal>NULL</>;
15823+
<parameter>identity</> is the complete object identity, with the precise format
15824+
depending on object type, and each part within the format being
15825+
schema-qualified and quoted as necessary.
15826+
</para>
15827+
15828+
<para>
15829+
<function>pg_identify_object_as_address</function> returns a row containing
15830+
enough information to uniquely identify the database object specified by
15831+
catalog OID, object OID and a (possibly zero) sub-object ID. The returned
15832+
information is independent of the current server, that is, it could be used
15833+
to identify an identically named object in another server.
15834+
<parameter>type</> identifies the type of database object;
15835+
<parameter>name</> and <parameter>args</> are text arrays that together
15836+
form a reference to the object. These three columns can be passed to
15837+
<function>pg_get_object_address</> to obtain the internal address
15838+
of the object.
15839+
This function is the inverse of <function>pg_get_object_address</function>.
15840+
</para>
15841+
15842+
<para>
15843+
<function>pg_get_object_address</function> returns a row containing enough
15844+
information to uniquely identify the database object specified by its
15845+
type and object name and argument arrays. The returned values are the
15846+
ones that would be used in system catalogs such as <structname>pg_depend</>
15847+
and can be passed to other system functions such as
15848+
<function>pg_identify_object</> or <function>pg_describe_object</>.
15849+
<parameter>catalog_id</> is the OID of the system catalog containing the
15850+
object;
15851+
<parameter>object_id</> is the OID of the object itself, and
15852+
<parameter>object_sub_id</> is the object sub-ID, or zero if none.
15853+
This function is the inverse of <function>pg_identify_object_as_address</function>.
15854+
</para>
15855+
1579315856
<indexterm>
1579415857
<primary>col_description</primary>
1579515858
</indexterm>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp