Re: BUG #19903: ALTER COLUMN TYPE: "unexpected object depending on column" internal error via partition key

From: Andres Freund <andres(at)anarazel(dot)de>
To: hackerzheng666(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: BUG #19903: ALTER COLUMN TYPE: "unexpected object depending on column" internal error via partition key
Date: 2026-11-16 22:53:49
Message-ID: 3konxkc35kxdicd7h64w5zxoof3i35kzu2gbv764sy74g5axsu@ukiltjdaxywe
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2026-11-15 04:47:59 +0000, PG Bug reporting form wrote:
> 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
>
> (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)".)

Maybe I'm just tired, but that's not something anybody actually cares about
right? I guess we can dress this up to have a nicer error message, but also,
who cares?

I think we want to do something here, it might be better to focus on rejecting
such absurd partition by clauses...

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2026-11-16 23:01:01 Re: BUG #19903: ALTER COLUMN TYPE: "unexpected object depending on column" internal error via partition key
Previous Message Tom Lane 2026-11-16 22:46:17 Re: BUG #19906: Backend crash (signal 11) creating a LANGUAGE sql function that returns a composite type from a sub-