pgsql: Reject CLUSTER (ANALYZE).

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reject CLUSTER (ANALYZE).
Date: 2026-08-13 20:31:09
Message-ID: E1wuc4y-00000000S6s-3YRa@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Reject CLUSTER (ANALYZE).

The introduction of the REPACK command also added support for
CLUSTER (ANALYZE). Presumably this was unintentional, as the
CLUSTER docs make no mention of it. CLUSTER (ANALYZE) on an
ordinary table succeeds and does indeed analyze the table, but a
database-wide CLUSTER (ANALYZE) or one on a partitioned table
fails with an error like:

ERROR: cannot execute REPACK (ANALYZE) on multiple tables

Rather than improving support for CLUSTER (ANALYZE) and thereby
encouraging folks to use CLUSTER instead of REPACK, let's just
reject it. This commit does so by teaching ExecRepack() to ERROR
for the ANALYZE option in anything except REPACK commands. Note
that VACUUM (FULL, ANALYZE) does not go through ExecRepack() and
therefore is unaffected by this change.

Oversight in commit ac58465e06.

Reported-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Author: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Discussion: https://postgr.es/m/CAN4CZFMVcgv1b2G-i%2Bkhs2MDnzWSr7O_53j_x%2BuhAxUV5rwWqw%40mail.gmail.com
Backpatch-through: 19

Branch
------
master

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

Modified Files
--------------
src/backend/commands/repack.c | 7 +++++++
1 file changed, 7 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2026-08-13 21:36:02 pgsql: Fix authorization check for role membership changes.
Previous Message Tom Lane 2026-08-13 15:20:52 pgsql: Consistently enforce tsvector/tsquery maximum lengths.