pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: imchifan@mail.com
Subject: BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs
Date: Wed, 11 Nov 2026 13:09:08 +0000
Message-ID: <19878-47dc6875d990d8df@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19878
Logged by:          Faye
Email address:      imchifan@mail.com
PostgreSQL version: 18.6
Operating system:   Linux/amd64
Description:        

Passing an unsupported class ID to pg_identify_object() or
pg_identify_object_as_address() produces SQLSTATE XX000 (internal_error).
These public object-address inspection functions should classify invalid
user input as SQLSTATE 22023 (invalid_parameter_value) instead.

The block below records pg_describe_object() as a comparison, but its result
is not part of the assertion. The assertion applies only to the two
pg_identify_* functions.

How to repeat:

Save this as reproducer.sql and run `psql -X -d postgres -f reproducer.sql`:

```
-- The two pg_identify_* functions take the same (classid, objid, objsubid)
-- address as pg_describe_object() and must classify an unsupported classid
as
-- invalid_parameter_value (22023), never internal_error (XX000).
-- describe_code is recorded only as a comparison and is not asserted.
DO $object_address$
DECLARE
  describe_code text;
  identify_code text;
  address_code text;
BEGIN
  BEGIN
    PERFORM pg_describe_object(1::oid, 1::oid, 0);
  EXCEPTION WHEN OTHERS THEN
    GET STACKED DIAGNOSTICS describe_code = RETURNED_SQLSTATE;
  END;

  BEGIN
    PERFORM pg_identify_object(1::oid, 1::oid, 0);
  EXCEPTION WHEN OTHERS THEN
    GET STACKED DIAGNOSTICS identify_code = RETURNED_SQLSTATE;
  END;

  BEGIN
    PERFORM pg_identify_object_as_address(1::oid, 1::oid, 0);
  EXCEPTION WHEN OTHERS THEN
    GET STACKED DIAGNOSTICS address_code = RETURNED_SQLSTATE;
  END;

  RAISE NOTICE 'describe=%, identify=%, as_address=%',
               describe_code, identify_code, address_code;

  IF identify_code IS DISTINCT FROM '22023'
     OR address_code IS DISTINCT FROM '22023' THEN
    RAISE EXCEPTION
      'oracle failed: describe=%, identify=%, as_address=% (expected
22023)',
      describe_code, identify_code, address_code;
  END IF;
END
$object_address$;

-- DO creates no persistent database objects; cleanup is vacuous.
```

I get the following output:

```
NOTICE:  describe=XX000, identify=XX000, as_address=XX000
ERROR:  oracle failed: describe=XX000, identify=XX000, as_address=XX000
(expected 22023)
CONTEXT:  PL/pgSQL function inline_code_block line 30 at RAISE
```

The issue was reproduced on PostgreSQL 18.6 on Linux/amd64. The anonymous
block creates no persistent database objects, and the server remains usable
after the error.

This occurs when object-address inspection code passes an unsupported class
ID to pg_identify_object() or pg_identify_object_as_address().








view thread (2+ messages)  latest in thread

Message-ID: <19878-47dc6875d990d8df@postgresql.org>
Permalink:  ../19878-47dc6875d990d8df@postgresql.org/
Also on:    postgresql.org/message-id/19878-47dc6875d990d8df@postgresql.org

 · 

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: noreply@postgresql.org, imchifan@mail.com
  Subject: Re: BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs
  In-Reply-To: <19878-47dc6875d990d8df@postgresql.org>
  References: <19878-47dc6875d990d8df@postgresql.org>

* 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