| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | tablecmds: reject CLUSTER ON for partitioned tables earlier |
| Date: | 2026-01-21 03:55:27 |
| Message-ID: | CAEoWx2kggo1N2kDH6OSfXHL_5gKg3DqQ0PdNuL4LH4XSTKJ3-g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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/
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-tablecmds-reject-CLUSTER-ON-for-partitioned-table.patch | application/octet-stream | 2.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ashutosh Bapat | 2026-01-21 04:18:54 | Re: commented out code |
| Previous Message | shveta malik | 2026-01-21 03:50:07 | Re: Simplify code building the LR conflict messages |