Re: docs: clarify ALTER TABLE behavior on partitioned tables

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: docs: clarify ALTER TABLE behavior on partitioned tables
Date: 2026-01-26 04:16:24
Message-ID: 4ADB3A71-86B2-46FA-AC27-E5BA4E3FF1A1@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Jan 24, 2026, at 09:16, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
>
> On Fri, Jan 23, 2026 at 5:57 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> "A nonrecursive DROP COLUMN (i.e., ALTER TABLE ONLY ... DROP COLUMN)
> never removes any descendant columns, but instead marks them as
> independently defined rather than inherited."
>
> This part is now undocumented, it was only mentioned in this paragraph.
>
> True, it's left implied instead of explicitly stated. Any column that exists on a child but not the parent is by definition "independently defined". So if either ONLY is supplied or the rules for cascading delete are not met the result is children with independently defined columns with that name.
>
> The original note was wrong anyway for the two-parent case - the second parent prevents the marking as independent when the first parent's column is dropped.
>
> Decided to test this one and I see the original wording was correct and we will need to keep a note that in the two-parent ONLY case the un-dropped children are marked both dependent and independent.
>
> Change:
>
> <para>
> For inheritance setups, a descendant column is removed only if both of the
> following are true: this is the only parent defining the column, and the column
> was never independently defined in the descendant.
> </para>
>
> To:
>
> "For inheritance setups, a descendant column is removed only if all the following are true: ONLY is not specified, no other parent defines the column, and the column is not marked as having been independent. Otherwise, the descendant column is instead marked as having been independent.
>
> If we think that deserves a bit longer explanation about that/why/how a column can be both dependent and "having been independent" we should cross-reference to a more appropriate location. Here we just state this is one way that condition can materialize.
>
> David J.
>

Thanks a lot for the test. Included in v7.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2026-01-26 04:36:15 Re: docs: clarify ALTER TABLE behavior on partitioned tables
Previous Message Chao Li 2026-01-26 04:15:27 Re: docs: clarify ALTER TABLE behavior on partitioned tables