Re: ALTER TABLE: warn when actions do not recurse to partitions

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: Greg Sabino Mullane <htamfids(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ALTER TABLE: warn when actions do not recurse to partitions
Date: 2026-01-13 04:02:54
Message-ID: CAEoWx2kQ9aSn-0LGPKc=woj+h-HR4uBV9TL20aeM3HzLmFqgFQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 13, 2026 at 11:42 AM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Monday, January 12, 2026, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
>>
>> Now, the message is like:
>> ```
>> evantest=# alter table sensor_data replica identity full;
>> NOTICE: REPLICA IDENTITY does not apply to partitions (1 affected)
>> ALTER TABLE
>>
>
>
> If it doesn't recurse there should be no count. It would either always be
> 1, so not helpful, or if did show a partition count, beside the point. In
> the later case suppress the message if there are no partitions present.
>

The count was real. I agree that we can suppress the message when there are
no partitions. Addressed that in v3.

>
> The statement “does not apply to partitions” is also factually wrong. One
> would just need to name the partition explicitly.
>
> NOTICE: present partitions not affected
> HINT: partitions may be modified individually using separate commands
> ALTER TABLE
>

Thanks for the suggestion, I took that in v3.

PSA v3:

* Rephrased the notice message as David's suggestion.
* Removed partition count from notice message.
* If a partitioned table doesn't have any partition, then suppress the
message.

Now the command outputs look like:
```
evantest=# alter table sensor_data replica identity full;
NOTICE: present partitions not affected
HINT: partitions may be modified individually using separate commands
ALTER TABLE
```

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

Attachment Content-Type Size
v3-0001-Add-notice-when-ALTER-TABLE-REPLICA-IDENTITY-does.patch application/octet-stream 4.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-01-13 04:09:31 RE: [Patch] add new parameter to pg_replication_origin_session_setup
Previous Message zengman 2026-01-13 03:59:32 Re: typedef indentation in pg_shmem.h