Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRZIl-002TWP-1h for pgsql-hackers@arkaria.postgresql.org; Mon, 25 May 2026 17:41:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wRZIj-001kjf-0F for pgsql-hackers@arkaria.postgresql.org; Mon, 25 May 2026 17:41:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRZIi-001kjX-1z for pgsql-hackers@lists.postgresql.org; Mon, 25 May 2026 17:41:17 +0000 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wRZIh-00000000jYJ-0ocr for pgsql-hackers@postgresql.org; Mon, 25 May 2026 17:41:16 +0000 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-69d7b4da91dso2404021eaf.3 for ; Mon, 25 May 2026 10:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779730874; cv=none; d=google.com; s=arc-20240605; b=IRGXIxKi4oTR2gBAqyw1K/60nUh9Ed9FgL89eC2FbZ8LJ+K0m042Si/R02jH2yLOr6 OC8CqMl2V9eW0Z1cCew3lEggHF3EXra5iKzxYRlI1V9NUxsspPXfvldH9yvkYdrnovj/ tsfhsPQGUwFLVz6ProlCQfq5nW6G6rf5XJz8noRuBiMJeDIs9UrOR2hyTZ17MEGdU3ju myUO874nZhsmejqkcjE1jHQ+9r/sbKPQC4zMmHWsa2gE0D/irQs8FIl/XgQQzeKCxutU aSR1zZ1UgCNiCE4AXMoBQ/0FBPDMKhitK1ljegakfVRQtGq3C8FJLccmTuBzLQSHbtqU djOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UbkcTIiYdnyHpkmD/Ntxu746Yhj75dF1QAFYA3Ru5QQ=; fh=8Zmz1QWYMMJMjQXEp8NafYmdnOTZBueFdOS/gpmejZ0=; b=Cc8MoYJmWJQO5E/stwBEVJDQ0pJu2Ik/kXiJemOLaYfuGfOxReKOzB1EU+hn4xhQ8s nDluRJ+4ly74yXsprQaGdSHIounKDeaB6WuJ80jWZyHbE2rr8w+cgtLuwmUTabdZdZQo aGeHFX1sAJr9eXpK2IKTAC4l66PRkwMHKs/DZjlycO75nFcaBQ03w9YXeefdzLk1emke +ot7fXinlLBrZG7i7cZtBhJiVLNyHf9QDW2dAfVN3CEvg4ubsX3ozUAFlUqspLiza7LR TdSvwwwOzVjfIjUdhfCYLJkBQiV58eDgVEeVSAjRfMO2vcRCGrC3ufGlm8Fl8WYdxFOK lmFw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779730874; x=1780335674; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UbkcTIiYdnyHpkmD/Ntxu746Yhj75dF1QAFYA3Ru5QQ=; b=Twz5gHmjUuGfANR4yjWjHUYuZe5oi7bUm5UT9HG93SVMPfBGDt9PdzvY/qLdTYf5p8 YiVIpY8ICYILDkKEcav+iB09VzWuNungPUxy8CvOjyo7Bsra6Fu/+bbfw6MlwHBxvuJK XHnCm4vmMgUyB3yk+D9I02ahf4dpGjIPOg+ALhCtCiIpqHSEYa252TVSy4kyjaHQ8Xw9 gfXxzEF12SDBwh/Pu65VoupTY1ea1m3PUN0akfzVftV44m3bWK0xRTUj5sg2eaEMziHR Q0VJ63UJj4jYuswd7fUVfPoKBZzmv6jQY38VaHLsMzIKNelhZJS1VIM3EtuJNIgnDAbx Mv3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779730874; x=1780335674; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UbkcTIiYdnyHpkmD/Ntxu746Yhj75dF1QAFYA3Ru5QQ=; b=QlqfpyuVORgeLS5SMjvX8reLb8Wz7a1MRkHLeb4X6xi3oYzjLPE42iKeE8hWd6V7c/ sEOmMcrjXkIMZ1ppp4Meco96Ys5hjFIisC64OHS343Ec/w9W2Chzvkbf7LsPJLhhJxJg LOVqSuImBLbl3E530zSaHlfXqWUwu7eppGyQK3qxo8fqGShfxaQahUjXleP4NNZTN2mn g6C0JxkHJG68zB8LdORjw0GUzVSbIJ3dJ43qXzkeVgJ9w3/TbNu3GrqeAbVsStEaFIWm t1IN9FRIDLuumc8ettB8ibyYYFsFjfTRPwD/GO7bo8m0/qDpM+EzkqvAda+vImQ1OndZ oWFQ== X-Forwarded-Encrypted: i=1; AFNElJ/OeOcs87hBY9al1wVUctjrmVo6RtsR0saZcOZfZ+DVpZLkEIpHMLAxa+epDN19SBYfta85FnJUrzzDEMgS@postgresql.org X-Gm-Message-State: AOJu0YyThKM6B9wj7Cs83oJKqvDkPRG+QrgNUj9/8ugHuLAahmslCTlD /jNsdfkW2UZtEKEyGVATbimwCCwiqM/1pT/3gIFZVSJgpXAb+pWnL7B7JwWfU0dM0nTshSbDuK0 CzPfS35VelIU3qaLA5FUrLhhm8flZmaE= X-Gm-Gg: Acq92OHy9L8JXTdHt5MNuul4cFC0ll3kov2udAxjDQdKKvHf/JTXM+3P3ZlIbyl1qQv LP0e+f+ZJ7nuTxtkak+K5ka7/LFueBmJRgMxaTbmUpeJiqSw+LgYHj5zanqa0xQ8dvGjPQEl1ue doiE9MbjUEHAw7fsJ+RY6DfUo6SqkYfhTAyp1WAMRY2s0RKk+qk4C11hOEwqQfjHCmLwBOnAkdI 4dYgsFYUFWO4SP7vkgvhcddjra3MJlfj8ETBk8fFCGE/k5PxVbXWQBMghdRCQOCzvG7zitwfb7P UvgbxC5BB0vmYpUGoLakHuI/Fti7JXJp6T863kl1dadCxkPLX1kNY3HfEUq6k4sDU5YnC5sI1W5 Dy3aezVg= X-Received: by 2002:a05:6820:1345:b0:69d:af07:424c with SMTP id 006d021491bc7-69daf074ebbmr3175378eaf.16.1779730874475; Mon, 25 May 2026 10:41:14 -0700 (PDT) MIME-Version: 1.0 References: <4df20e70-a083-4334-9548-5f8b9025847c@postgrespro.ru> <4B04275C-E044-4EEE-BE64-6FEEE73DCBB0@gmail.com> <09307DC2-64A1-4D6A-9EAF-9A86A173A7FC@gmail.com> <8204A871-4650-4B3F-8260-8D5FD40908B3@gmail.com> <4AEA11EB-0439-401B-996E-F1835F510E8D@gmail.com> In-Reply-To: From: Alexander Korotkov Date: Mon, 25 May 2026 20:41:02 +0300 X-Gm-Features: AVHnY4KTmL5IFaWydHF7NlVI8A3GvORAI-BnnL6O3Af6w8dyBmGBQeG4gdkO-Gg Message-ID: Subject: Re: Fix SPLIT PARTITION bound-overlap bug and other improvements To: Chao Li Cc: Dmitry Koval , PostgreSQL-development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, May 21, 2026 at 2:23=E2=80=AFAM Chao Li wr= ote: > > > On May 21, 2026, at 05:17, Alexander Korotkov wr= ote: > > On Wed, May 20, 2026 at 11:29=E2=80=AFPM Alexander Korotkov > > wrote: > >> On Wed, May 20, 2026 at 2:46=E2=80=AFPM Alexander Korotkov wrote: > >>> On Wed, May 20, 2026 at 9:29=E2=80=AFAM Chao Li wrote: > >>>>> On May 20, 2026, at 14:19, Alexander Korotkov wrote: > >>>>> On Wed, May 20, 2026 at 2:37=E2=80=AFAM Chao Li wrote: > >>>>>>> On May 19, 2026, at 19:00, Alexander Korotkov wrote: > >>>>>>> On Tue, May 19, 2026 at 5:50=E2=80=AFAM Chao Li wrote: > >>>>>>>>> On May 18, 2026, at 20:04, Alexander Korotkov wrote: > >>>>>>>>> > >>>>>>>>> On Mon, May 18, 2026 at 2:57=E2=80=AFPM Chao Li wrote: > >>>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> v3-0001 through v3-0003 look good to me. > >>>>>>>>>> > >>>>>>>>>> For v3-0004, I have a suspicion, but it's late here and my bra= in 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 n= ot. So I spent some time creating a test that uses a case-insensitive colla= tion: > >>>>>>>> ``` > >>>>>>>> evantest=3D# create collation case_insensitive (provider=3Dicu, = locale=3D'und-u-ks-level2', deterministic =3D false); > >>>>>>>> CREATE COLLATION > >>>>>>>> evantest=3D# create table t (b text collate case_insensitive) pa= rtition by list (b); > >>>>>>>> CREATE TABLE > >>>>>>>> evantest=3D# create table tp_ab partition of t for values in ('a= ', 'b'); > >>>>>>>> CREATE TABLE > >>>>>>>> evantest=3D# 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 par= tition > >>>>>>>> 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 DE= FAULT partition. > >>>>>>>> ``` > >>>>>>>> > >>>>>>>> In this test, the split partition=E2=80=99s bound is ('a', 'b'),= and the new partition=E2=80=99s bound is ('a', 'A'). Their list lengths ar= e both 2, but the two bounds are actually different, because 'a' and 'A' ar= e considered equal by the collation. > >>>>>>>> > >>>>>>>> So, in the LIST path, since check_partition_bounds_for_split_lis= t() has already ensured that the new partition=E2=80=99s bound is contained= within the split partition=E2=80=99s bound, we need to check the reverse d= irection as well. Whether the split partition=E2=80=99s bound is also conta= ined in the new partition=E2=80=99s bound. If yes, the two bounds are ident= ical. > >>>>>>>> > >>>>>>>> See the attached v4 for my changes for 0004. 0001-0003 are uncha= nged. Since 0001 and 0003 are independent of 0004, maybe they can be pushed= first. > >>>>>>> > >>>>>>> I've pushed 0001-0003. > >>>>>> > >>>>>> Thanks for pushing them. > >>>>>> > >>>>>>> Thank you for discovering the collation issue > >>>>>>> in 0004. Note that original approach of using > >>>>>>> partition_bounds_equal() can't handle different collations too (a= s it > >>>>>>> internally uses datumIsEqual()). > >>>>>> > >>>>>> Yes, I realized that while reviewing v3. That=E2=80=99s reason I d= idn=E2=80=99t get back v2 and only worked again based on v3. > >>>>>> > >>>>>>> I've revised the remaining patch: > >>>>>>> made function header comment a bit more detailed > >>>>>> > >>>>>> This part looks good to me. > >>>>>> > >>>>>>> and added additional > >>>>>>> regression tests. Please, check. > >>>>>>> > >>>>>> > >>>>>> But I don=E2=80=99t see any change for regression test between v4 = and v5. Maybe you forgot to save your changes? > >>>>> > >>>>> Sorry, I just mess up, no changes in tests. > >>>>> I'm going to push this if no objection. > >>>>> > >>>> > >>>> No worries. Then v5 looks good to me. > >>> > >>> Thank you, pushed. > >> > >> Uhhh, most of buildfarm animals don't support locales used in our > >> tests. I've to revert that, > > > > The another attempt is attached. Now use -0.0 and 0.0 as binary > > different but logically equivalent values, no locale dependence. > > > > ------ > > Regards, > > Alexander Korotkov > > Supabase > > > > Thank you very much for taking care of that. This was a lesson learned fo= r me. > > Actually, when I added the ICU test, I did think about whether regression= tests support ICU. So I searched the existing tests for =E2=80=9Cicu=E2=80= =9D and found some examples. For instance, src/test/regress/sql/collate.icu= .utf8.sql has tests like: > ``` > RESET icu_validation_level; > CREATE COLLATION testx (provider =3D icu, locale =3D '@colStrength=3Dprim= ary;nonsense=3Dyes'); DROP COLLATION testx; > CREATE COLLATION testx (provider =3D icu, locale =3D 'nonsense-nowhere');= DROP COLLATION testx; > ``` > > I added v6 to CF to get a CI run and check whether the buildfarm is happy= with v6. The CI test has passed now. See [1]. The new test using =E2=80=9C= -0.0" also looks good to me. > > [1] https://commitfest.postgresql.org/patch/6796/ Pushed, thank you. AFAICS, it runs ok on buildfarm now. ------ Regards, Alexander Korotkov Supabase