tablecmds: reject CLUSTER ON for partitioned tables earlier
Chao Li <li.evan.chao@gmail.com>
From: Chao Li <li.evan.chao@gmail.com>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-21T03:55:27Z
Lists: pgsql-hackers
Attachments
- v1-0001-tablecmds-reject-CLUSTER-ON-for-partitioned-table.patch (application/octet-stream) patch v1-0001
Hi Hacker, I noticed this while working other patches related to “ALTER TABLE”. “ALTER TABLE … CLUSTER ON” and "SET WITHOUT CLUSTER" are not supported for partitioned tables, but currently ATPrepCmd() allows them through and they only fail later at execution time. This patch rejects these commands earlier by using the existing ATSimplePermissions() infrastructure in ATPrepCmd(), matching the handling of other unsupported ALTER TABLE actions on partitioned tables (such as SET LOGGED / SET UNLOGGED). This makes the behavior more consistent and simplifies the code path. As a result, the error reported for partitioned tables changes: Before the patch: ``` evantest=# ALTER TABLE p_test CLUSTER ON idx_p_test_id; ERROR: cannot mark index clustered in partitioned table ``` With the patch: ``` evantest=# ALTER TABLE p_test CLUSTER ON idx_p_test_id; ERROR: ALTER action CLUSTER ON cannot be performed on relation "p_test" DETAIL: This operation is not supported for partitioned tables. ``` Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
Commits
-
Refactor some code around ALTER TABLE [NO] INHERIT
- 1a7ccd2b332d 19 (unreleased) landed
-
Add regression test for ALTER TABLE .. NO INHERIT on typed tables
- cbf9a72993ec 19 (unreleased) landed
-
Reject ALTER TABLE .. CLUSTER earlier for partitioned tables
- c336133c65a7 19 (unreleased) landed
-
Ignore partitioned indexes where appropriate
- 05fb5d661925 11.0 cited