Skip to content

Commit 0f3637a

Browse files
committed
Make argument names of pg_get_object_address consistent, and fix docs.
pg_get_object_address and pg_identify_object_as_address are supposed to be inverses, but they disagreed as to the names of the arguments representing the textual form of an object address. Moreover, the documented argument names didn't agree with reality at all, either for these functions or pg_identify_object. In HEAD and v11, I think we can get away with renaming the input arguments of pg_get_object_address to match the outputs of pg_identify_object_as_address. In theory that might break queries using named-argument notation to call pg_get_object_address, but it seems really unlikely that anybody is doing that, or that they'd have much trouble adjusting if they were. In older branches, we'll just live with the lack of consistency. Aside from fixing the documentation of these functions to match reality, I couldn't resist the temptation to do some copy-editing. Per complaint from Jean-Pierre Pelletier. Back-patch to 9.5 where these functions were introduced. (Before v11, this is a documentation change only.) Discussion: https://postgr.es/m/CANGqjDnWH8wsTY_GzDUxbt4i=y-85SJreZin4Hm8uOqv1vzRQA@mail.gmail.com
1 parent b7156cf commit 0f3637a

File tree

1 file changed

+55
-52
lines changed

1 file changed

+55
-52
lines changed

doc/src/sgml/func.sgml

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17541,32 +17541,34 @@ SELECT collation for ('foo' COLLATE "de_DE");
1754117541

1754217542
<tbody>
1754317543
<row>
17544-
<entry><literal><function>pg_describe_object(<parameter>catalog_id</parameter>, <parameter>object_id</parameter>, <parameter>object_sub_id</parameter>)</function></literal></entry>
17544+
<entry><literal><function>pg_describe_object(<parameter>classid</parameter> <type>oid</type>, <parameter>objid</parameter> <type>oid</type>, <parameter>objsubid</parameter> <type>integer</type>)</function></literal></entry>
1754517545
<entry><type>text</type></entry>
1754617546
<entry>get description of a database object</entry>
1754717547
</row>
1754817548
<row>
17549-
<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>
17550-
<entry><parameter>type</> <type>text</>, <parameter>schema</> <type>text</>, <parameter>name</> <type>text</>, <parameter>identity</> <type>text</></entry>
17549+
<entry><literal><function>pg_identify_object(<parameter>classid</parameter> <type>oid</type>, <parameter>objid</parameter> <type>oid</type>, <parameter>objsubid</parameter> <type>integer</type>)</function></literal></entry>
17550+
<entry><parameter>type</parameter> <type>text</type>, <parameter>schema</parameter> <type>text</type>, <parameter>name</parameter> <type>text</type>, <parameter>identity</parameter> <type>text</type></entry>
1755117551
<entry>get identity of a database object</entry>
1755217552
</row>
1755317553
<row>
17554-
<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>
17555-
<entry><parameter>type</> <type>text</>, <parameter>name</> <type>text[]</>, <parameter>args</> <type>text[]</></entry>
17554+
<entry><literal><function>pg_identify_object_as_address(<parameter>classid</parameter> <type>oid</type>, <parameter>objid</parameter> <type>oid</type>, <parameter>objsubid</parameter> <type>integer</type>)</function></literal></entry>
17555+
<entry><parameter>type</parameter> <type>text</type>, <parameter>object_names</parameter> <type>text[]</type>, <parameter>object_args</parameter> <type>text[]</type></entry>
1755617556
<entry>get external representation of a database object's address</entry>
1755717557
</row>
1755817558
<row>
17559-
<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>
17560-
<entry><parameter>catalog_id</> <type>oid</>, <parameter>object_id</> <type>oid</>, <parameter>object_sub_id</> <type>int32</></entry>
17561-
<entry>get address of a database object, from its external representation</entry>
17559+
<entry><literal><function>pg_get_object_address(<parameter>type</parameter> <type>text</type>, <parameter>name</parameter> <type>text[]</type>, <parameter>args</parameter> <type>text[]</type>)</function></literal></entry>
17560+
<entry><parameter>classid</parameter> <type>oid</type>, <parameter>objid</parameter> <type>oid</type>, <parameter>objsubid</parameter> <type>integer</type></entry>
17561+
<entry>get address of a database object from its external representation</entry>
1756217562
</row>
1756317563
</tbody>
1756417564
</tgroup>
1756517565
</table>
1756617566

1756717567
<para>
1756817568
<function>pg_describe_object</function> returns a textual description of a database
17569-
object specified by catalog OID, object OID and a (possibly zero) sub-object ID.
17569+
object specified by catalog OID, object OID, and sub-object ID (such as
17570+
a column number within a table; the sub-object ID is zero when referring
17571+
to a whole object).
1757017572
This description is intended to be human-readable, and might be translated,
1757117573
depending on server configuration.
1757217574
This is useful to determine the identity of an object as stored in the
@@ -17575,30 +17577,31 @@ SELECT collation for ('foo' COLLATE "de_DE");
1757517577

1757617578
<para>
1757717579
<function>pg_identify_object</function> returns a row containing enough information
17578-
to uniquely identify the database object specified by catalog OID, object OID and a
17579-
(possibly zero) sub-object ID. This information is intended to be machine-readable,
17580+
to uniquely identify the database object specified by catalog OID, object OID and
17581+
sub-object ID. This information is intended to be machine-readable,
1758017582
and is never translated.
17581-
<parameter>type</> identifies the type of database object;
17582-
<parameter>schema</> is the schema name that the object belongs in, or
17583-
<literal>NULL</> for object types that do not belong to schemas;
17584-
<parameter>name</> is the name of the object, quoted if necessary, only
17585-
present if it can be used (alongside schema name, if pertinent) as a unique
17586-
identifier of the object, otherwise <literal>NULL</>;
17587-
<parameter>identity</> is the complete object identity, with the precise format
17588-
depending on object type, and each part within the format being
17589-
schema-qualified and quoted as necessary.
17583+
<parameter>type</parameter> identifies the type of database object;
17584+
<parameter>schema</parameter> is the schema name that the object belongs in, or
17585+
<literal>NULL</literal> for object types that do not belong to schemas;
17586+
<parameter>name</parameter> is the name of the object, quoted if necessary,
17587+
if the name (along with schema name, if pertinent) is sufficient to
17588+
uniquely identify the object, otherwise <literal>NULL</literal>;
17589+
<parameter>identity</parameter> is the complete object identity, with the
17590+
precise format depending on object type, and each name within the format
17591+
being schema-qualified and quoted as necessary.
1759017592
</para>
1759117593

1759217594
<para>
1759317595
<function>pg_identify_object_as_address</function> returns a row containing
1759417596
enough information to uniquely identify the database object specified by
17595-
catalog OID, object OID and a (possibly zero) sub-object ID. The returned
17597+
catalog OID, object OID and sub-object ID. The returned
1759617598
information is independent of the current server, that is, it could be used
1759717599
to identify an identically named object in another server.
17598-
<parameter>type</> identifies the type of database object;
17599-
<parameter>name</> and <parameter>args</> are text arrays that together
17600-
form a reference to the object. These three columns can be passed to
17601-
<function>pg_get_object_address</> to obtain the internal address
17600+
<parameter>type</parameter> identifies the type of database object;
17601+
<parameter>object_names</parameter> and <parameter>object_args</parameter>
17602+
are text arrays that together form a reference to the object.
17603+
These three values can be passed to
17604+
<function>pg_get_object_address</function> to obtain the internal address
1760217605
of the object.
1760317606
This function is the inverse of <function>pg_get_object_address</function>.
1760417607
</para>
@@ -17607,13 +17610,13 @@ SELECT collation for ('foo' COLLATE "de_DE");
1760717610
<function>pg_get_object_address</function> returns a row containing enough
1760817611
information to uniquely identify the database object specified by its
1760917612
type and object name and argument arrays. The returned values are the
17610-
ones that would be used in system catalogs such as <structname>pg_depend</>
17613+
ones that would be used in system catalogs such as <structname>pg_depend</structname>
1761117614
and can be passed to other system functions such as
17612-
<function>pg_identify_object</> or <function>pg_describe_object</>.
17613-
<parameter>catalog_id</> is the OID of the system catalog containing the
17615+
<function>pg_identify_object</function> or <function>pg_describe_object</function>.
17616+
<parameter>classid</parameter> is the OID of the system catalog containing the
1761417617
object;
17615-
<parameter>object_id</> is the OID of the object itself, and
17616-
<parameter>object_sub_id</> is the object sub-ID, or zero if none.
17618+
<parameter>objid</parameter> is the OID of the object itself, and
17619+
<parameter>objsubid</parameter> is the sub-object ID, or zero if none.
1761717620
This function is the inverse of <function>pg_identify_object_as_address</function>.
1761817621
</para>
1761917622

@@ -20477,23 +20480,23 @@ FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger();
2047720480
<tbody>
2047820481
<row>
2047920482
<entry><literal>classid</literal></entry>
20480-
<entry><type>Oid</type></entry>
20483+
<entry><type>oid</type></entry>
2048120484
<entry>OID of catalog the object belongs in</entry>
2048220485
</row>
2048320486
<row>
2048420487
<entry><literal>objid</literal></entry>
20485-
<entry><type>Oid</type></entry>
20486-
<entry>OID of the object in the catalog</entry>
20488+
<entry><type>oid</type></entry>
20489+
<entry>OID of the object itself</entry>
2048720490
</row>
2048820491
<row>
2048920492
<entry><literal>objsubid</literal></entry>
2049020493
<entry><type>integer</type></entry>
20491-
<entry>Object sub-id (e.g. attribute number for columns)</entry>
20494+
<entry>Sub-object ID (e.g. attribute number for a column)</entry>
2049220495
</row>
2049320496
<row>
2049420497
<entry><literal>command_tag</literal></entry>
2049520498
<entry><type>text</type></entry>
20496-
<entry>command tag</entry>
20499+
<entry>Command tag</entry>
2049720500
</row>
2049820501
<row>
2049920502
<entry><literal>object_type</literal></entry>
@@ -20512,14 +20515,14 @@ FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger();
2051220515
<entry><literal>object_identity</literal></entry>
2051320516
<entry><type>text</type></entry>
2051420517
<entry>
20515-
Text rendering of the object identity, schema-qualified. Each and every
20516-
identifier present in the identity is quoted if necessary.
20518+
Text rendering of the object identity, schema-qualified. Each
20519+
identifier included in the identity is quoted if necessary.
2051720520
</entry>
2051820521
</row>
2051920522
<row>
2052020523
<entry><literal>in_extension</literal></entry>
2052120524
<entry><type>bool</type></entry>
20522-
<entry>whether the command is part of an extension script</entry>
20525+
<entry>True if the command is part of an extension script</entry>
2052320526
</row>
2052420527
<row>
2052520528
<entry><literal>command</literal></entry>
@@ -20564,37 +20567,37 @@ FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger();
2056420567
<tbody>
2056520568
<row>
2056620569
<entry><literal>classid</literal></entry>
20567-
<entry><type>Oid</type></entry>
20570+
<entry><type>oid</type></entry>
2056820571
<entry>OID of catalog the object belonged in</entry>
2056920572
</row>
2057020573
<row>
2057120574
<entry><literal>objid</literal></entry>
20572-
<entry><type>Oid</type></entry>
20573-
<entry>OID the object had within the catalog</entry>
20575+
<entry><type>oid</type></entry>
20576+
<entry>OID of the object itself</entry>
2057420577
</row>
2057520578
<row>
2057620579
<entry><literal>objsubid</literal></entry>
20577-
<entry><type>int32</type></entry>
20578-
<entry>Object sub-id (e.g. attribute number for columns)</entry>
20580+
<entry><type>integer</type></entry>
20581+
<entry>Sub-object ID (e.g. attribute number for a column)</entry>
2057920582
</row>
2058020583
<row>
2058120584
<entry><literal>original</literal></entry>
2058220585
<entry><type>bool</type></entry>
20583-
<entry>Flag used to identify the root object(s) of the deletion</entry>
20586+
<entry>True if this was one of the root object(s) of the deletion</entry>
2058420587
</row>
2058520588
<row>
2058620589
<entry><literal>normal</literal></entry>
2058720590
<entry><type>bool</type></entry>
2058820591
<entry>
20589-
Flag indicating that there's a normal dependency relationship
20592+
True if there was a normal dependency relationship
2059020593
in the dependency graph leading to this object
2059120594
</entry>
2059220595
</row>
2059320596
<row>
2059420597
<entry><literal>is_temporary</literal></entry>
2059520598
<entry><type>bool</type></entry>
2059620599
<entry>
20597-
Flag indicating that the object was a temporary object.
20600+
True if this was a temporary object
2059820601
</entry>
2059920602
</row>
2060020603
<row>
@@ -20623,26 +20626,26 @@ FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger();
2062320626
<entry><literal>object_identity</literal></entry>
2062420627
<entry><type>text</type></entry>
2062520628
<entry>
20626-
Text rendering of the object identity, schema-qualified. Each and every
20627-
identifier present in the identity is quoted if necessary.
20629+
Text rendering of the object identity, schema-qualified. Each
20630+
identifier included in the identity is quoted if necessary.
2062820631
</entry>
2062920632
</row>
2063020633
<row>
2063120634
<entry><literal>address_names</literal></entry>
2063220635
<entry><type>text[]</type></entry>
2063320636
<entry>
2063420637
An array that, together with <literal>object_type</literal> and
20635-
<literal>address_args</literal>,
20636-
can be used by the <function>pg_get_object_address()</function> to
20638+
<literal>address_args</literal>, can be used by
20639+
the <function>pg_get_object_address()</function> function to
2063720640
recreate the object address in a remote server containing an
20638-
identically named object of the same kind.
20641+
identically named object of the same kind
2063920642
</entry>
2064020643
</row>
2064120644
<row>
2064220645
<entry><literal>address_args</literal></entry>
2064320646
<entry><type>text[]</type></entry>
2064420647
<entry>
20645-
Complement for <literal>address_names</literal> above.
20648+
Complement for <literal>address_names</literal>
2064620649
</entry>
2064720650
</row>
2064820651
</tbody>

0 commit comments

Comments
 (0)