pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joel Jacobson <joel@compiler.org>
To: pgsql-bugs@lists.postgresql.org
Subject: [BUG] pg_identify_object_as_address() returns duplicate values
Date: Wed, 31 Mar 2021 08:40:32 +0200
Message-ID: <f94aaa11-19b0-4b99-a5cf-3e0b49bbe5dd@www.fastmail.com> (raw)

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

Message-ID: <f94aaa11-19b0-4b99-a5cf-3e0b49bbe5dd@www.fastmail.com>
Permalink:  ../f94aaa11-19b0-4b99-a5cf-3e0b49bbe5dd@www.fastmail.com/
Also on:    postgresql.org/message-id/f94aaa11-19b0-4b99-a5cf-3e0b49bbe5dd@www.fastmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: joel@compiler.org
  Subject: Re: [BUG] pg_identify_object_as_address() returns duplicate values
  In-Reply-To: <f94aaa11-19b0-4b99-a5cf-3e0b49bbe5dd@www.fastmail.com>
  References: <f94aaa11-19b0-4b99-a5cf-3e0b49bbe5dd@www.fastmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox