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 1wcJw9-003G84-1P for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2026 09:30:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wcJv8-0005oZ-0w for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2026 09:29:22 +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 1wcJv7-0005oI-2j for pgsql-hackers@lists.postgresql.org; Wed, 24 Jun 2026 09:29:21 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wcJv0-000000000GF-1CsA for pgsql-hackers@postgresql.org; Wed, 24 Jun 2026 09:29:15 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-809b19a7f25so231367b3.3 for ; Wed, 24 Jun 2026 02:29:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782293353; cv=none; d=google.com; s=arc-20240605; b=ZBZX78iO8RXCeV1KHnYeDMbpiW53oQSbLlbNi0gkaC8O2AC1PWfAjPcXl+wFeKbq7R k9hpGXFcvqSCIFVcK68qHN28yCGXsu6HhsNxLGYh/SaXFxQLFlp7XUnc0TA18FC8OpnX JEyLmkfhmn6OPoOHyOyR3MORI9tfOLuxb3CVXI0TrNJ+0TiVaCzWp/Dv5Jao/2ILuSB9 72HLwtEK6cDarADJC8mbRTFfKNmYmLpWbceWp7WS0byKywnCpflKQppIqQUw+x8Gr9uq /nw0ad6QQuOxNP/UFqiEdsRRQQpL+OLbOx3ClOlzpt39RM+m7rbE8udMlLOCxLJ1ZsNZ lK6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=vK2V2/P729FbdU3DtCVeie7HLuVPXuY2c4EH3/I3nqg=; fh=xkxilC6vRhigvNSYQkL36SkKm5h71wiwPyesalfRw5M=; b=Abp0nrgC+oN25MFzpHcD1pS7fyHk4u1Mr8r+WLleV9kcXKDAadkG1emrMuc4Qx0Les eUIQ5tMIMA4E9OLj9OyiEi5pGk5k7oA/NaLN4Z1LAGHoNpKywqfnPiytTYrECDjD+U10 CyNX4tiEr3MZdBFzkBjRS4jTE60lnjcaOaNBfZvjOqKAwzvPUgrg85vtuuqQ358Rt4f3 iDntbXSJq3so9VFyHMq3NZ4fqZ+yEeOcJwoYMPtQyajI6Yqxxh2GG0qbvUq18GzQYFwe hCbzKbPDCFGA/BAv5irSjj8YQHVxY4xSU7vcBvj6niUJ1dZGrYqIc5Vh414WR1/X7eDo Kvjw==; 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=1782293353; x=1782898153; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vK2V2/P729FbdU3DtCVeie7HLuVPXuY2c4EH3/I3nqg=; b=IIPzrSd1Xinp2w2VhZKVhfv2qc5TL2nAJSic2ZBa19DXFm6mR+7X7M7BsnZPaoET5f 7C/RJf7NSIAIfKHPLc0t2JVmZZ8KpIye867HmP8yGMlicFw4++hOsnzYlDAWa43JQ9ag 7ClY9Zd70Chn79EGBtoFgXZ/+FukAjMsc8wDX0Z0Jw82LvIIjLH4sk9Vvg144D8uJJDF 6/S7coYlEbwylciqqLDD8Z1ovPPCF9t4+GcPxWRJz7S2q4k4OcmkdNWjMvtlFM3p4/Dt 469RmBIWQ1qb+YCBIUM5hi2U7Q0ToHYWLyjuDH3qKO6nM7ZMpSFoOGt3Jq///cIZjpIl v25w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782293353; x=1782898153; h=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=vK2V2/P729FbdU3DtCVeie7HLuVPXuY2c4EH3/I3nqg=; b=OwLMM1Z+GyEgdh1lm1Or3EDrS6KbFbfG/RtLfaM50Qlylinav82iNcFIPoFFFpLTBR zF/OX2Re7LzPnCP10cXMpW8JDGPWRypij4EBYMke4CkF5vZ6vJMGEwwYtVXZJ+6HobJ0 AKxwMowla06uP2rheZNvM5FuBKgI1sC8lNRVt3BHmlhJ8BCRWXMYeBuCMfjbGZChzB4L 4k/ZmQWMT6gLSzSNUl4S4XJtIshDv1Ttw6akCIzRpcrBXwCQiEswnsyQbstxdFzQW/py uINAzsWjXBzYgE2aZYDum4mpGUcp0wGtol95fGDYKqBvESzneCLpdjSJEV2qUYXlCS8E +7fg== X-Forwarded-Encrypted: i=1; AHgh+RpJEKqzFL+d27EsG0Lh/6UDUN+TF3qUTa+0A77QfOx8++NzBRtoBK1C8Tw8xd6a/xtrG7SK6z+IO6dNRdYc@postgresql.org X-Gm-Message-State: AOJu0YzVKn+HOGLytbzTJikmqx5jlGBzBBJdpWwNitpEqkJPg5at/3I8 dQM+Fv+kZy+/vsjPKOs4u9UjRJj+6mAVEwyZNtNC6J0q3o/NQ0fPwTUtwKSa5sOlsvRWiwOli6e pdjHhNeYuSvCHr5U5V6AqkJEcRRhKSZ/Otg== X-Gm-Gg: AfdE7clhadLiuHJ2m3YUMjPWMKjl+r3qtgf6YlIS0HhkG/cFIId3H7XJKFGTV8c33Kp Lc7OMeIM0TpU+d62TMRGaJl9XvVOQDqZn8ash5X7mUoBaFYDzVB1lc+e/Pc1bBdBKBFyW9oWiIG Aij2JNzytNtCPStGybnphBrbcnR5dXidVenNqqjvDF19AtS4lFu6DFL/Td9xFHSpxI6JLXSq0a4 AgcH/8WNQ8KnJTWXwebtOXl+CFKmdDRfGS+CMhtOl4l1oUDM0OsERMlLo1iypSy1n9ILY11Yy2/ h3hYiPVWsA== X-Received: by 2002:a05:690c:d87:b0:7f6:bed8:5420 with SMTP id 00721157ae682-807ee193f19mr22538957b3.16.1782293353522; Wed, 24 Jun 2026 02:29:13 -0700 (PDT) MIME-Version: 1.0 References: <541F240E-94AD-4D65-9794-7D6C316BC3FF@gmail.com> In-Reply-To: From: Ayush Tiwari Date: Wed, 24 Jun 2026 14:59:02 +0530 X-Gm-Features: AVVi8CcpvpjswslhGKB-Dh2BhWSlagLFbr_p15bzUd9ueGUR_18UuXhviy9dYIw Message-ID: Subject: Re: Small patch to improve safety of utf8_to_unicode(). To: Jeff Davis Cc: Chao Li , pgsql-hackers@postgresql.org Content-Type: multipart/alternative; boundary="00000000000038e9920654fc8240" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000038e9920654fc8240 Content-Type: text/plain; charset="UTF-8" Hi, On Wed, 24 Jun 2026 at 11:15, Jeff Davis wrote: > On Mon, 2026-06-22 at 19:02 -0700, Jeff Davis wrote: > > v4 attached. > > v5 attached. > > There's an extra patch 0002 to fix a logic bug when handling final > sigma (only affects the builtin pg_unicode_fast locale), which I think > should be backported to 18. > > Also added tests. > Thanks for the patch! I took a look at the v5 series and tried it locally. The split between the backpatchable defensive change, the final-sigma fix, and the newer utf8encode/utf8decode API work for master makes sense to me. On my machine, case-check fails before reaching the new invalid-UTF8 assertions. I think it's because PostgreSQL's Unicode tables are 17.0 while my system ICU is 15.1, so the exhaustive ICU comparison in test_icu() hits a changed mapping and exits first. Would it be worth running test_convert_case() before test_icu()? It wouldn't make case-check pass on a mismatched-ICU system, but it would at least let the non-ICU conversion and the new invalid-UTF8 cases run before the ICU comparison aborts. Regards, Ayush --00000000000038e9920654fc8240 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Wed, 24 Jun 2026 = at 11:15, Jeff Davis <pgsql@j-davis.com> wrote:
On Mon, 2026-06-22 at 19:02 -0700, Jeff Davis wrote:<= br> > v4 attached.

v5 attached.

There's an extra patch 0002 to fix a logic bug when handling final
sigma (only affects the builtin pg_unicode_fast locale), which I think
should be backported to 18.

Also added tests.

Thanks for the patch!

I t= ook a look at the v5 series and tried it locally. The split between the
= backpatchable defensive change, the final-sigma fix, and the newer
utf8e= ncode/utf8decode API work for master makes sense to me.=C2=A0

On my = machine, case-check fails before reaching the new invalid-UTF8
assertion= s. I think it's because PostgreSQL's Unicode tables are 17.0 while = my
system ICU is 15.1, so the exhaustive ICU comparison in test_icu() hi= ts a
changed mapping and exits first.

Would it be worth ru= nning test_convert_case() before
test_icu()? It wouldn't make case-c= heck pass on a mismatched-ICU system, but it
would at least let the non-= ICU conversion and the new invalid-UTF8 cases run
before the ICU compari= son aborts.

Regards,
Ayush
--00000000000038e9920654fc8240--