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 1wcXFn-003Qii-0m for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2026 23:43:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wcXFm-0033b2-09 for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2026 23:43:34 +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 1wcXFl-0033at-28 for pgsql-hackers@lists.postgresql.org; Wed, 24 Jun 2026 23:43:33 +0000 Received: from mail-dy1-x1336.google.com ([2607:f8b0:4864:20::1336]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wcXFj-0000000069l-23Wm for pgsql-hackers@postgresql.org; Wed, 24 Jun 2026 23:43:32 +0000 Received: by mail-dy1-x1336.google.com with SMTP id 5a478bee46e88-30b6dad2382so2908624eec.0 for ; Wed, 24 Jun 2026 16:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20251104.gappssmtp.com; s=20251104; t=1782344610; x=1782949410; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=wqeDBBXxFVYmnn5YNqTX7F4u0Yl0W8RfM4JPUPjJf+M=; b=j5LucHtQj5ouwc0mYQgPuBdu+RyHVU9owWRdLoJi6fTop4MsncGoIGBZOr7+Pe8JF/ hyhsZ/B/L1r57ll/4zn8PhBhcKze/KGTIVwvwdlFw6ne+8xdunR0NMT9YMTwoT/FyGZg sfgLE63r2f2nsMiSOoFXwH/21raOWPSRjf3X57sp/85GAuOxxEB4v1XRuAC9O62stvBu YN76oljlVKhg7lM23HwJCMaGFnNTcZUJ/Y04o84iVaHSoBVyU35G8g9iICGd4f8VlHK1 Ygi5fHOcgikbm/vMMYTv+sNWl7IKfLkdWXUzDaFrftCKWOlZ1k6HzWpdgy95fF5nd97/ RNww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782344610; x=1782949410; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wqeDBBXxFVYmnn5YNqTX7F4u0Yl0W8RfM4JPUPjJf+M=; b=ou+x5UVmNt21mW/aRNUc7a31bFE6peuLo3zDjObKrhrp4ABnQ1sK7EDDbccpFyOshj oDxQmu8SZdy0FatGyeCkYnOEHefIax0jMVv9Q+6874mkD+NVDf3yJn29OCT+LF/fyKac efbPhU7rj8XPaD+4W5LQXN/Wz9drj/YQhbqQBk7wNOGY+6i7yE1uvB78/yGwvcPvI6F0 HFLZGmjc7MEtKJ270YlDEAX3u0R3UW0u/ESyz90g7VDfJ41iSguLhUMWvelLVcOt30eD 8glUE87yhkE88UbxDeZrp+v1DkXzzdP/UhYaz4AZgqCRKcv0+PPYD470dPTfPYd4AVSq vAnw== X-Forwarded-Encrypted: i=1; AHgh+RoxlSYaZrsswu7eF81X3rLf6V4sRqdoZ3Gq5OGSFBxBVJ8BG7DwhzS3KL96qxoR2DLNLO3eA56ADmkcm1WH@postgresql.org X-Gm-Message-State: AOJu0YzkhGmRrtzBFdZziVSHD2mLCLOwrcFutR/jsYWZMXH6TzNQCXnM yhBvJ5VNsNF/gWsA8tiMhK3e/gaaDGi2Gw8TRLCwB7GymKjRDbMeQ2601FIh56ALvQ== X-Gm-Gg: AfdE7cmT60NNfRB9KgM2WnMFY2rX3mU2j5TDKkTF46r4iaYNu7aCBkFDd9Zzpe16ufv LCHFbdQdgSHdYm4f+3l06OLXm2rzRQLF48VYi7q8zayEiu/mdxBSS+g0kNqEB8tR0vaLYJRcxvn kIc9s5Y7+N0gbq5ax+ScR1PW5+ghXBkG0CbhSOmP4tlcW7y0o0tyvx3iL4RW/JzPov48Wz570X8 PnaUr2jiDYrK7IQWiCWgHK94rAYjIFFi/JZ8mH46h4o+QWc/+EyRCxEdRD/QbAIRDBXfpM/KWNa /V9lmHltIsJLIv3usKptoFSGy9u+2SUbeYhclyuOMk9dfCyADXo5/NYKkTE7QZr/ELvohgY9mO7 OxaXNZsbkVncYXW65FsrLcoahHNsrquqltZuziZtLKGy30bDTnkVorPmDbWQxT0tPqUpzCd9Lr/ PdWSXAkBO5sUdw+5GlY1WcN7cDMQkY8VScmCPUr1FOQwANLw== X-Received: by 2002:a05:7300:8b15:b0:304:cefc:5fe3 with SMTP id 5a478bee46e88-30c84caaa5bmr286373eec.18.1782344610416; Wed, 24 Jun 2026 16:43:30 -0700 (PDT) Received: from jeff-ws-bridge.lan (c-24-7-19-3.hsd1.ca.comcast.net. [24.7.19.3]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30c7c8afca8sm2262745eec.17.2026.06.24.16.43.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2026 16:43:29 -0700 (PDT) Message-ID: Subject: Re: Small patch to improve safety of utf8_to_unicode(). From: Jeff Davis To: Ayush Tiwari Cc: Chao Li , pgsql-hackers@postgresql.org Date: Wed, 24 Jun 2026 16:43:28 -0700 In-Reply-To: References: <541F240E-94AD-4D65-9794-7D6C316BC3FF@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1.1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2026-06-24 at 14:59 +0530, Ayush Tiwari wrote: > 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.=C2=A0 Thank you for taking a look. > 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. Yes, that test is a bit awkward because most of it is a comparison to results from ICU, so if ICU is unavailable or based on an older version of Unicode, then the test doesn't work. > Would it be worth running test_convert_case() before > test_icu()? If we want to make those independent of ICU, I think we'd move them to a regular test suite that's exercised everywhere (not just as part of the 'update-unicode' target). But if we did so, that would be a very small test suite, because most of the results are already checked in the normal SQL tests. What makes these tests different is that they are exercising invalid UTF8 behavior, which we don't expect to happen through ordinary SQL. Regards, Jeff Davis