Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xR8rW-00000000idN-3VKJ for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Nov 2026 13:59:42 +0000 Received: from localhost ([127.0.0.1]:46710 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xR8rV-0000000BMB8-1Lew for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Nov 2026 13:59:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:34670) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xR85X-0000000B1Uz-2TDo for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 13:10:08 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xR85W-00000000NMW-32TW for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 13:10:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=90Gr6XfVIIVuNwUEWN5qpLJYkzR1m76su+a5qdSKGbw=; b=TXLFrsui2k4Z5OsivvC1VGUAdq 0qWVf5p06xW/JLOCZiEefd+Sib2zWpBbzhi9fPtkcii4mLoaFaS18zZLc20ZAtFaBlUgpEUJUYmdi fg9xZiKfUANZZOgFV6k/GHbX9jOOXItkRSg11cbbyRo/8LtplrZZKaixpt4iayxZ7g6UirmCBKWkJ MI6tBWUBlUMCdC63MPNxieGr66BEE6iCMtbz/rzjMVgOgKTazrLGBvqsdKaLL7PuBiD68wULJ0ujr ngU4fcBEsaaHN+fNPAoX/mfc4cRB4KLBrOi6wUwHw9tE5QPsbZbhJotegMehIaL+JZpNiX9rdQsik eTVGUffw==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xR85V-000000012JL-2v4L for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 13:10:06 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xR85T-00000002hzZ-42ke for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 13:10:04 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19878: pg_identify_object functions expose XX000 for unsupported class IDs To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: imchifan@mail.com Reply-To: imchifan@mail.com, pgsql-bugs@lists.postgresql.org Date: Wed, 11 Nov 2026 13:09:08 +0000 Message-ID: <19878-47dc6875d990d8df@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: =20 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 =3D RETURNED_SQLSTATE; END; BEGIN PERFORM pg_identify_object(1::oid, 1::oid, 0); EXCEPTION WHEN OTHERS THEN GET STACKED DIAGNOSTICS identify_code =3D RETURNED_SQLSTATE; END; BEGIN PERFORM pg_identify_object_as_address(1::oid, 1::oid, 0); EXCEPTION WHEN OTHERS THEN GET STACKED DIAGNOSTICS address_code =3D RETURNED_SQLSTATE; END; RAISE NOTICE 'describe=3D%, identify=3D%, as_address=3D%', 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=3D%, identify=3D%, as_address=3D% (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=3DXX000, identify=3DXX000, as_address=3DXX000 ERROR: oracle failed: describe=3DXX000, identify=3DXX000, as_address=3DXX0= 00 (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().