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

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, 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-22 19:27:11
Message-ID: fb70022a-5403-4e16-9efc-28b041f35d9a@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Chao

On 22/01/2026 06:45, Chao Li wrote:
> evantest=# alter table p_test replica identity full, alter column
> username set (n_distinct = 0.1);
> NOTICE:  ALTER action REPLICA IDENTITY on relation "p_test" does not
> affect present partitions
> HINT:  partitions may be modified individually, or specify ONLY to
> suppress this message
> NOTICE:  ALTER action ALTER COLUMN ... SET on relation "p_test" does not
> affect present partitions
> HINT:  partitions may be modified individually, or specify ONLY to
> suppress this message
> ALTER TABLE

One could argue that encapsulating all conditions in
EmitPartitionNoRecurseNotice(), meaning it is called all the time, is
slightly inefficient, but the impact is really negligible in this case -
and it is how it is done in similar functions in tablecmds.c :) The code
LGTM.

One small thing:

errhint is supposed to be capitalised - see Error Message Style Guide[1]

"Detail and hint messages: Use complete sentences, and end each with a
period. Capitalize the first word of sentences. Put two spaces after the
period if another sentence follows (for English text; might be
inappropriate in other languages)."

ereport(NOTICE,
errmsg("ALTER action %s on relation \"%s\" does not affect present
partitions",
action_str,
RelationGetRelationName(rel)),
errhint("partitions may be modified individually, or specify ONLY to
suppress this message"));

What about this?

HINT: To update partitions, apply the command to each one individually,
or specify ONLY to suppress this message.

I'll test the newly covered subcomands tomorrow.

Best, Jim

1 - https://www.postgresql.org/docs/current/error-style-guide.html

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message KAZAR Ayoub 2026-01-22 19:32:43 Re: Speed up COPY FROM text/CSV parsing using SIMD
Previous Message Tom Lane 2026-01-22 19:17:08 Re: Remove PG_MMAP_FLAGS