Re: docs: clarify ALTER TABLE behavior on partitioned tables

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

On Sunday, January 25, 2026, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:

>
> > <para>
> > When applied to a partitioned table, partition columns and
> constraints
> > are implicitly renamed.
> > Specifying <literal>ONLY</literal> is not allowed, and this command
> > cannot be used on individual partitions.
> > </para>
>
> But for "Specifying <literal>ONLY</literal> is not allowed, and this
> command, cannot be used on individual partitions.”, that doesn’t seem
> correct. See my test:
> ```
> evantest=# create table root (i int, j int) partition by list(i);
> CREATE TABLE
> evantest=# create table p1 partition of root for values in (1);
> CREATE TABLE
> evantest=# alter table p1 rename to pp1; <== Rename a partition is allowed.
> ALTER TABLE
> evantest=# alter table only pp1 rename to p1; <== ONLY can be used, but
> just no effect
> ALTER TABLE
> ```
>

I was mentally restricting the second sentence about ONLY to the column and
constraints renaming action, which are called out by the first sentence.
It makes little sense to talk about renaming the table, parent or child,
here in the context of ONLY. It goes without mention that table renaming
never cascades. Only is implied for that action, even if only should just
be considered valid on a parent in any case.

But I’d accept a sentence like: “Table renames always only apply to the
named table.” Added to that paragraph; it’s a convoluted command.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-01-26 05:13:14 Re: docs: clarify ALTER TABLE behavior on partitioned tables
Previous Message Chao Li 2026-01-26 04:16:24 Re: docs: clarify ALTER TABLE behavior on partitioned tables