| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
| Cc: | Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Fix SPLIT PARTITION bound-overlap bug and other improvements |
| Date: | 2026-05-19 02:50:03 |
| Message-ID: | 09307DC2-64A1-4D6A-9EAF-9A86A173A7FC@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On May 18, 2026, at 20:04, Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> On Mon, May 18, 2026 at 2:57 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>>> <v3-0003-Clarify-SPLIT-PARTITION-bound-requirements-in-doc.patch><v3-0001-Fix-SPLIT-PARTITION-range-bound-validation-with-D.patch><v3-0002-Fix-SPLIT-PARTITION-hint-for-DEFAULT-partition-bo.patch><v3-0004-Reject-degenerate-SPLIT-PARTITION-with-DEFAULT-pa.patch>
>>
>> v3-0001 through v3-0003 look good to me.
>>
>> For v3-0004, I have a suspicion, but it's late here and my brain is getting slow, so I would like to study it more tomorrow.
>
> Sure, take your time.
>
> ------
> Regards,
> Alexander Korotkov
> Supabase
My suspicion was that check_split_partition_not_same_bound() now has two paths. The RANGE path honors collation, while the LIST path does not. So I spent some time creating a test that uses a case-insensitive collation:
```
evantest=# create collation case_insensitive (provider=icu, locale='und-u-ks-level2', deterministic = false);
CREATE COLLATION
evantest=# create table t (b text collate case_insensitive) partition by list (b);
CREATE TABLE
evantest=# create table tp_ab partition of t for values in ('a', 'b');
CREATE TABLE
evantest=# alter table t split partition tp_ab into
evantest-# (partition tp_a for values in ('a', 'A'),
evantest(# partition tp_default default);
ERROR: cannot split partition "tp_ab" only to add a DEFAULT partition
LINE 2: (partition tp_a for values in ('a', 'A'),
^
DETAIL: The non-DEFAULT partition would keep the same partition bound.
HINT: Use CREATE TABLE ... PARTITION OF ... DEFAULT to add a DEFAULT partition.
```
In this test, the split partition’s bound is ('a', 'b'), and the new partition’s bound is ('a', 'A'). Their list lengths are both 2, but the two bounds are actually different, because 'a' and 'A' are considered equal by the collation.
So, in the LIST path, since check_partition_bounds_for_split_list() has already ensured that the new partition’s bound is contained within the split partition’s bound, we need to check the reverse direction as well. Whether the split partition’s bound is also contained in the new partition’s bound. If yes, the two bounds are identical.
See the attached v4 for my changes for 0004. 0001-0003 are unchanged. Since 0001 and 0003 are independent of 0004, maybe they can be pushed first.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-Fix-SPLIT-PARTITION-range-bound-validation-with-D.patch | application/octet-stream | 4.1 KB |
| v4-0002-Fix-SPLIT-PARTITION-hint-for-DEFAULT-partition-bo.patch | application/octet-stream | 10.1 KB |
| v4-0003-Clarify-SPLIT-PARTITION-bound-requirements-in-doc.patch | application/octet-stream | 3.8 KB |
| v4-0004-Reject-degenerate-SPLIT-PARTITION-with-DEFAULT-pa.patch | application/octet-stream | 11.9 KB |
| unknown_filename | text/plain | 3 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-05-19 03:19:36 | Re: Improve conflict detection when replication origins are reused |
| Previous Message | Fujii Masao | 2026-05-19 01:13:22 | Re: COPY FROM ON_ERROR SET_NULL bypasses domain NOT NULL with partial column list |