[BUG] pg_identify_object_as_address() returns duplicate values

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: [BUG] pg_identify_object_as_address() returns duplicate values
Date: 2021-03-31 06:40:32
Message-ID: f94aaa11-19b0-4b99-a5cf-3e0b49bbe5dd@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

The documentation for this function says

"Returns a row containing enough information to uniquely identify the database object specified by catalog OID, object OID and sub-object ID"

However, this contract is broken for some pg_collation.oid values.

The problem is "collencoding" is not included in the data returned by pg_identify_object_as_address(),
but "collencoding" *is* included in the UNIQUE UNIQUE CONSTRAINT: (collname, collencoding, collnamespace).

Example:

SELECT pg_identify_object_as_address('pg_collation'::regclass,oid,0), * FROM pg_collation WHERE collname = 'en_GB';
pg_identify_object_as_address | oid | collname | collnamespace | collowner | collprovider | collisdeterministic | collencoding | collcollate | collctype
-------------------------------------+-------+----------+---------------+-----------+--------------+---------------------+--------------+------------------+------------------
(collation,"{pg_catalog,en_GB}",{}) | 13662 | en_GB | 11 | 10 | c | t | 6 | en_GB | en_GB
(collation,"{pg_catalog,en_GB}",{}) | 13754 | en_GB | 11 | 10 | c | t | 8 | en_GB.ISO8859-1 | en_GB.ISO8859-1
(collation,"{pg_catalog,en_GB}",{}) | 13755 | en_GB | 11 | 10 | c | t | 16 | en_GB.ISO8859-15 | en_GB.ISO8859-15
(3 rows)

/Joel

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexey Bashtanov 2021-03-31 15:12:40 should all not-null constraints be inherited?
Previous Message Neil Chen 2021-03-31 03:30:54 Re: Inconsistent behavior of pg_dump/pg_restore on DEFAULT PRIVILEGES