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 1wPqFq-0014bJ-1o for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2026 23:23:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wPqFo-008jr1-1C for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2026 23:23:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wPqFo-008jqt-08 for pgsql-hackers@lists.postgresql.org; Wed, 20 May 2026 23:23:09 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wPqFm-00000000cnk-3PKc for pgsql-hackers@postgresql.org; Wed, 20 May 2026 23:23:08 +0000 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-c795f441ff7so4371188a12.2 for ; Wed, 20 May 2026 16:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779319384; x=1779924184; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Us5LG5HhG/3ViL+V2YP1BqvTShhrPa1waa7bKBxM55A=; b=TMYqe2d3pIZLw6tGEgjTmP9TEai5qHxWSFRbKboYTLZvafv521Zpieflk2YYWCXmV8 VgXB9BW4iWngxXtIkO5DwXBqQ3IDz2rl7grmnVyf7paRSnW0JyznO/oHiRRhYvMK2BD/ Nv3qBmuiH1lW1cRJD+uKBmWvLPZXNSGQ4qEWIb5UjgTD00N4x/ZtxHcEQ//XFkTIXtcA D89zzLIuEnyh2Y2y39BhsCiBcApFF9+GfvMDFRYScbBxQ8UGgvihlvTl0ITtZi2oJUkG SgQWF3F6+jkAoGZUVohGIzvObWIenveAmw4tZqK0BzbUcl9zAcl0pyFD/2uP8DRsZWhN DtQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779319384; x=1779924184; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Us5LG5HhG/3ViL+V2YP1BqvTShhrPa1waa7bKBxM55A=; b=CooPb6NaVEmrfxYNAO7lP/kjqT2LENIQwQ8ZHJIvyUKmlpHXKpG+8Sd9Lz4ZvJV0p0 R50c0tkEgU0QJ0EGWptoOsaKGxQfDNaRhXopko2LpcG+VE3pJovtA7RL+GNlBR9fmxU0 MAXZtZcbD/9pYFKR9RCCHYelbVd4NYxRFgtrX5m2IZNuzYwOVafodf9tAfoB+owkRV/H 9KlyzuwBxhOAvWG2w2Ai8zPO66dxUQ5Yq1rDRobOUU86oSZ3YTZ1JMjQOMcwxIO2flwQ VadwkstaSA3F+lvz4GuU9JHLR4niWgqok4ZHBRYKmySc5Tm7H9LoxKXQJItoWXD+YQUJ 00uw== X-Forwarded-Encrypted: i=1; AFNElJ/P13v/jVNbjRqBTCU3rgWqaMtGnL3wgK6tM7WbNkTnfUDdyXH+iF58N2Ogn4gHWV/T0JzGDP4NmPo+mfxh@postgresql.org X-Gm-Message-State: AOJu0Yw8TZ7ah4jMcj6dAEanhOBvUcLQoOm5ftQbqYPfaasTdzIMHyAK wmAiCl9M7EsZ/lA0gMfDJznJ7WWly/Yo+5Wb6JWZHXzL2Jc6exOStS3E X-Gm-Gg: Acq92OGEHHTdMvnMzZdSk/345Cd7fxrjS438pMBfgDyk+7Cl3v8xU+LuBqE8drP3cLp KxilxmTyQ0oE99nZ/Sn5uxO4+853liD+7dwO2uPMvA4EHWD9Lw/7FOFvLxhCH8LpvOQBw8zzk/3 QWbzHsj0TAFaY+IpO/jtEY/885LXj655lYyyapjfmtiJXGBCOpOW5Kf0Xu0CCGAlZMdjQ+bRNKa n+9zdmPpm8ILOqtA5LtXyVbPYv7cipwQdBmF/4ctdlgPEGZCz8y/0W5V2E2E4idl2mwRYD2ih/Q fA0tw+11NJxs9gC1fge+igirX4MOCeqzuYn/e+47jxUSujBKMj7bN6zwtIkZDFxcEo+/+e+v4ZZ 7jlHe/tSXKR7Gq48NBzw3fNR3clSbbAWMKP5+SnIICJeQgTuo1GT4KX7myeWKL5xsJ/G2+rpUSf 5dC3UAGqDURnK+lEgFTewbq6aTTtmXK10= X-Received: by 2002:a05:6a20:748b:b0:398:4a1f:8a54 with SMTP id adf61e73a8af0-3b3086873a3mr436422637.2.1779319384126; Wed, 20 May 2026 16:23:04 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c82bb116832sm20691521a12.24.2026.05.20.16.23.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2026 16:23:03 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: Fix SPLIT PARTITION bound-overlap bug and other improvements From: Chao Li In-Reply-To: Date: Thu, 21 May 2026 07:22:24 +0800 Cc: Dmitry Koval , PostgreSQL-development Content-Transfer-Encoding: quoted-printable Message-Id: 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> To: Alexander Korotkov X-Mailer: Apple Mail (2.3864.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On May 21, 2026, at 05:17, Alexander Korotkov = wrote: >=20 > 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: >>>>>>>>>=20 >>>>>>>>> On Mon, May 18, 2026 at 2:57=E2=80=AFPM Chao Li = wrote: >>>>>>>>>>> = >>>>>>>>>>=20 >>>>>>>>>> v3-0001 through v3-0003 look good to me. >>>>>>>>>>=20 >>>>>>>>>> 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. >>>>>>>>>=20 >>>>>>>>> Sure, take your time. >>>>>>>>>=20 >>>>>>>>> ------ >>>>>>>>> Regards, >>>>>>>>> Alexander Korotkov >>>>>>>>> Supabase >>>>>>>>=20 >>>>>>>> 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=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) = partition 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 = 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. >>>>>>>> ``` >>>>>>>>=20 >>>>>>>> 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 are both 2, but the two bounds are actually different, because = 'a' and 'A' are considered equal by the collation. >>>>>>>>=20 >>>>>>>> So, in the LIST path, since = check_partition_bounds_for_split_list() has already ensured that the new = partition=E2=80=99s bound is contained within the split partition=E2=80=99= s bound, we need to check the reverse direction as well. Whether the = split partition=E2=80=99s bound is also contained in the new = partition=E2=80=99s bound. If yes, the two bounds are identical. >>>>>>>>=20 >>>>>>>> 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. >>>>>>>=20 >>>>>>> I've pushed 0001-0003. >>>>>>=20 >>>>>> Thanks for pushing them. >>>>>>=20 >>>>>>> Thank you for discovering the collation issue >>>>>>> in 0004. Note that original approach of using >>>>>>> partition_bounds_equal() can't handle different collations too = (as it >>>>>>> internally uses datumIsEqual()). >>>>>>=20 >>>>>> Yes, I realized that while reviewing v3. That=E2=80=99s reason I = didn=E2=80=99t get back v2 and only worked again based on v3. >>>>>>=20 >>>>>>> I've revised the remaining patch: >>>>>>> made function header comment a bit more detailed >>>>>>=20 >>>>>> This part looks good to me. >>>>>>=20 >>>>>>> and added additional >>>>>>> regression tests. Please, check. >>>>>>>=20 >>>>>>=20 >>>>>> But I don=E2=80=99t see any change for regression test between v4 = and v5. Maybe you forgot to save your changes? >>>>>=20 >>>>> Sorry, I just mess up, no changes in tests. >>>>> I'm going to push this if no objection. >>>>>=20 >>>>=20 >>>> No worries. Then v5 looks good to me. >>>=20 >>> Thank you, pushed. >>=20 >> Uhhh, most of buildfarm animals don't support locales used in our >> tests. I've to revert that, >=20 > The another attempt is attached. Now use -0.0 and 0.0 as binary > different but logically equivalent values, no locale dependence. >=20 > ------ > Regards, > Alexander Korotkov > Supabase > Thank you very much for taking care of that. This was a lesson learned = for 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=3Dprimary;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/ Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/