Re: BUG #19100: Different column type between partitioned table and detached pending partition table make errors

From: "Haiyang Li" <mohen(dot)lhy(at)alibaba-inc(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-bugs" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19100: Different column type between partitioned table and detached pending partition table make errors
Date: 2025-11-03 09:16:02
Message-ID: f2bb794d-96f4-440e-93d3-e5c51fe2b6cc.mohen.lhy@alibaba-inc.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello,
Thanks for your opinion.
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 2025-11-3日 02:36 write:
>> IMO, a detach pending child table is not affected by parent's DML or DQL,
>> but should still be affected by parent's DDL.
>
>I think it'd be far safer to refuse all forms of ALTER TABLE until the
> detach is completed.
I have been trying to think of a concrete scenario where this could cause problems
if ALTER TABLE permitted on detach pending partitions.
But I haven't come up with one yet. Could you provide an example or suggest some
possible cases?
OTOH, from a safety perspective, I would argue that pg_dump should avoid emitting
ATTACH PARTITION statements for detach pending child tables.
Regards,
Haiyang Li
------------------------------------------------------------------
From:Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Send Time:2025年11月3日(周一) 02:36
To:"李海洋(陌痕)"<mohen(dot)lhy(at)alibaba-inc(dot)com>
CC:"pgsql-bugs"<pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject:Re: BUG #19100: Different column type between partitioned table and detached pending partition table make errors
PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> It's evident that in both error cases, the failure occurs because
> column name has different data types between the parent and the child
> table. BTW, "\d+ users_p0" error happens when
> pg_get_partition_constraintdef() is called. The root cause seems to be
> that when running:
> ```
> ALTER TABLE users ALTER COLUMN name TYPE char(10);
> ```
> on the parent table, the statement does not affect a child table that is in
> detach pending state.
Ugh.
> IMO, a detach pending child table is not affected by parent's DML or DQL,
> but should still be affected by parent's DDL.
I think it'd be far safer to refuse all forms of ALTER TABLE until the
detach is completed.
regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2025-11-03 10:09:25 Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown
Previous Message Kuntal Ghosh 2025-11-03 05:57:51 Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown