pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reject ALTER TABLE .. CLUSTER earlier for partitioned tables
Date: Mon, 16 Mar 2026 08:49:11 +0000
Message-ID: <E1w23dO-000PXk-0i@gemulon.postgresql.org> (raw)

Reject ALTER TABLE .. CLUSTER earlier for partitioned tables

ALTER TABLE .. CLUSTER ON and SET WITHOUT CLUSTER are not supported for
partitioned tables and already fail with a check happening when the
sub-command is executed, not when it is prepared.

This commit moves the relkind check for partitioned tables to happen
when the sub-command is prepared in ATSimplePermissions().  This matches
with the practice of the other sub-commands of ALTER TABLE, shaving one
translatable string.

mark_index_clustered() can be a bit simplified, switching one
elog(ERROR) to an assertion.  Note that mark_index_clustered() can also
be called through a CLUSTER command, but it cannot be reached for a
partitioned table, per the assertion based on the relkind in
cluster_rel(), and there is only one caller of rebuild_relation().

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Discussion: https://postgr.es/m/CAEoWx2kggo1N2kDH6OSfXHL_5gKg3DqQ0PdNuL4LH4XSTKJ3-g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c336133c65a7ac3223a3cb492b8bbf4fa3999375

Modified Files
--------------
src/backend/commands/cluster.c        | 6 +-----
src/backend/commands/tablecmds.c      | 2 +-
src/test/regress/expected/cluster.out | 6 ++++--
3 files changed, 6 insertions(+), 8 deletions(-)



Message-ID: <E1w23dO-000PXk-0i@gemulon.postgresql.org>
Permalink:  ../E1w23dO-000PXk-0i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w23dO-000PXk-0i@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Reject ALTER TABLE .. CLUSTER earlier for partitioned tables
  In-Reply-To: <E1w23dO-000PXk-0i@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox