pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs
2+ messages / 2 participants
[nested] [flat]

* BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs
@ 2026-11-11 13:09 PG Bug reporting form <noreply@postgresql.org>
  2026-11-11 14:06 ` Re: BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2026-11-11 13:09 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: imchifan@mail.com

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().








^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs
  2026-11-11 13:09 BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs PG Bug reporting form <noreply@postgresql.org>
@ 2026-11-11 14:06 ` Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Gustafsson @ 2026-11-11 14:06 UTC (permalink / raw)
  To: imchifan@mail.com; pgsql-bugs@lists.postgresql.org

> On 11 Nov 2026, at 14:09, PG Bug reporting form <noreply@postgresql.org> wrote:

> 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.

That's not a bug, but a feature enhancement request.  If you would like to see
another errcode then feel free to submit a patch and argue for it's value.

--
Daniel Gustafsson







^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-11-11 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 13:09 BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs PG Bug reporting form <noreply@postgresql.org>
2026-11-11 14:06 ` Daniel Gustafsson <daniel@yesql.se>

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