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 1xSz3A-000000000qZ-0nm0 for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Nov 2026 15:55:21 +0000 Received: from localhost ([127.0.0.1]:54880 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xSz39-000000001v4-1kon for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Nov 2026 15:55:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:45092) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xSS9w-0000000Eoic-2X5h for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 04:48: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 1xSS9u-000000010U4-01n8 for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 04:48: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=Kc/yqkGmkBmNGk24vvauhhHreMQZkQn122dzfXSHHrM=; b=IxqVNjnJWek1ppY2BbeTaPg3xW Ubl0L9fyDA8tICrpB44QxmhtlKGsLwnLoJ6YCinl0lWacddN54FREVXgiRgdT6slPXBxIH39cpQPN 1EuZAF8e1yWGMDurXZwGJG5ejgURoy364ieZaKuX5eUn9ss4gXbMCDeh7uSXDE9oCT8//4AOY+p2i iMyZRyQmpgUuzg0zqV2jK0EALjYbZe4jGUuksSvbLBXY7wb9An0+gA/YrYuhLtpr968uP2Ng0Om1m h6M6bvZa+mXKajh3bGHbkm00SjV2n5Y7I8Vz/YercRN/yb0q3sITGRN9MYV+KRZ1twBxojT4eIyxD aWPiRbNA==; 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 1xSS9s-00000002nSX-30mE for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 04:48:05 +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 1xSS9r-00000006xm8-0HbA for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 04:48:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19903: ALTER COLUMN TYPE: "unexpected object depending on column" internal error via partition key To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: hackerzheng666@gmail.com Reply-To: hackerzheng666@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sun, 15 Nov 2026 04:47:59 +0000 Message-ID: <19903-06341b8535c78fc1@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: 19903 Logged by: Zheng Hacker Email address: hackerzheng666@gmail.com PostgreSQL version: 19rc2 Operating system: Linux x86_64 (Ubuntu 22.04) Description: =20 Tested on git master (20devel, commit 70c4a57b64d3; the code in question is unchanged at master 81b2179 as of 2026-11-14). Not tested on 19rc2 or older branches; the version selected in the form is only the closest listed one. ALTER COLUMN TYPE on a column of a table that is also used as a composite type raises an internal (XX000) error if the partition key expression of another table selects a field of that composite type: create table attbl(a numeric); create table atref(b text) partition by range ((('(1)'::attbl).a + length(b))); alter table attbl alter column a type bigint; ERROR: unexpected object depending on column: table atref The same dependency through an index expression or a CHECK constraint gives the expected user error: index expression : ERROR: cannot alter table "attbl" because index atref_1_numeric_length_b_idx uses its row type CHECK constraint : ERROR: cannot alter table "attbl" because constraint atref_check on table atref uses its row type In ATExecAlterColumnType() (tablecmds.c), the scan over the column's pg_depend entries has a "case RelationRelationId" branch that handles indexes and sequences and raises elog(ERROR, "unexpected object depending on column: %s") for every other relation kind. A partitioned table whose partition key expression selects a field of the altered composite type depends on that column through its pg_depend entry for the relation itself, so it ends up in that branch. Expected: a user-facing error in the same style as the index and constraint cases, for example "cannot alter table "attbl" because partition key of table "atref" uses its row type". (Found with a fuzzer; reduced by hand. Checked on current master only. A bare partition key (('(1)'::attbl).a) is rejected earlier with "cannot use constant expression as partition key", hence the "+ length(b)".) Related: BUG #19559 reports the same "unexpected object depending on column" elog from the same dependency scan for a property graph; this report is the partition-key-expression case, which falls in the RelationRelationId branch.