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 1w5ozr-003f9S-2K for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 17:59:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5ozo-004Q3u-2U for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 17:59:53 +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 1w5ozo-004Q3N-0j for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 17:59:52 +0000 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w5ozk-00000001B7f-00kc for pgsql-hackers@postgresql.org; Thu, 26 Mar 2026 17:59:51 +0000 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c24:fa2:0:640:41ee:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 411DC807A5; Thu, 26 Mar 2026 20:59:43 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6bf:8080:527::1:1d]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id exZa5A0AvW20-XFPwz3C5; Thu, 26 Mar 2026 20:59:42 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1774547982; bh=cGws6GLz3Fns79UlGOBVMDDXsiMNb/o7aBTvHpB1hyk=; h=References:To:Cc:In-Reply-To:Date:From:Message-Id:Subject; b=y0kAczciUvJNIlPjEYatMaBv8wSsPKJ00ruQth5i2pDm5SpvN/pvCxqU1YbjUeqcL gR/RKaGlyFEEOZfjxG0jI8+aUeO3/WNKrp+V8RzPNbAhJoZgBCMPzdFfcQxdue7Or6 ghcNY4Xr+lzg73McGMuLVsWsoUCPuhzzxqN5rWwg= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Andrey Borodin Message-Id: <975FB674-1C52-4431-B80F-298075198F25@yandex-team.ru> Content-Type: multipart/mixed; boundary="Apple-Mail=_6546D7F9-7B07-4BEE-8AF7-A3F0A1664C68" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions Date: Thu, 26 Mar 2026 22:59:30 +0500 In-Reply-To: Cc: Tom Lane , Aleksander Alekseev , pgsql-hackers , Chao Li , =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Masahiko Sawada References: <1791665551.452444.1761209220211.ref@mail.yahoo.com> <1895971769.8343.1761240853939@mail.yahoo.com> <574624399.175025.1761290201491@mail.yahoo.com> <953203149.383019.1761345585325@mail.yahoo.com> <6F76FA61-E2DC-44EF-9504-889D9BDB4EBD@yandex-team.ru> <1154454839.957923.1761604611424@mail.yahoo.com> <87ldkv8cog.fsf@wibble.ilmari.org> <87ikfz7zcu.fsf@wibble.ilmari.org> <9CB824CC-70DC-4165-AC6A-9664F47209EE@yandex-team.ru> <878qbn51kb.fsf@wibble.ilmari.org> <1F13AF7E-B90A-40FB-B47C-DC38FBB08353@gmail.com> <682417.1774482047@sss.pgh.pa.us> <431D684B-ABE2-461D-AA26-E009D2630CEA@yandex-team.ru> X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_6546D7F9-7B07-4BEE-8AF7-A3F0A1664C68 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 26 Mar 2026, at 22:30, Masahiko Sawada = wrote: >=20 > Feedback is very welcome. The patch is fine from my POV. Please consider these small improvements to the patch. Basically, we = reference to formula stated by RFC where possible. 0001 is intact. Best regards, Andrey Borodin. --Apple-Mail=_6546D7F9-7B07-4BEE-8AF7-A3F0A1664C68 Content-Disposition: attachment; filename=v2-0001-doc-Add-note-about-collation-requirements-for-bas.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="v2-0001-doc-Add-note-about-collation-requirements-for-bas.patch" Content-Transfer-Encoding: quoted-printable =46rom=20a6d2896079aef1885d34e9cb47da80c302987056=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Masahiko=20Sawada=20=0A= Date:=20Thu,=2026=20Mar=202026=2010:17:23=20-0700=0ASubject:=20[PATCH=20= v2=201/2]=20doc:=20Add=20note=20about=20collation=20requirements=20for=0A= =20base32hex=20sortability.=0A=0AWhile=20fixing=20the=20base32hex=20UUID=20= sortability=20test=20in=20commit=2089210037a0a,=0Ait=20turned=20out=20= that=20the=20expected=20lexicographical=20order=20is=20only=20maintained=0A= under=20the=20C=20collation=20(or=20an=20equivalent=20byte-wise=20= collation).=0A=0ASince=20this=20is=20not=20just=20a=20testing=20quirk=20= but=20could=20be=20a=20real=20trap=20users=0Amight=20fall=20into=20when=20= sorting=20encoded=20data=20in=20their=20databases,=20we=20added=0Aa=20= note=20to=20the=20documentation=20to=20make=20this=20requirement=20= explicitly=20clear.=0A=0AReviewed-by:=0ADiscussion:=20= https://postgr.es/m/CAD21AoAwX1D6baSGuQXm0mzPXPWB07kgaoaaahjNHHenbdY24A@ma= il.gmail.com=0A---=0A=20doc/src/sgml/func/func-binarystring.sgml=20|=208=20= ++++++++=0A=201=20file=20changed,=208=20insertions(+)=0A=0Adiff=20--git=20= a/doc/src/sgml/func/func-binarystring.sgml=20= b/doc/src/sgml/func/func-binarystring.sgml=0Aindex=20= 0aaf9bc68f1..9f731d7bca0=20100644=0A---=20= a/doc/src/sgml/func/func-binarystring.sgml=0A+++=20= b/doc/src/sgml/func/func-binarystring.sgml=0A@@=20-790,6=20+790,14=20@@=0A= =20=20=20=20=20=20=20=20produces=20a=2026-character=20string=20compared=20= to=20the=20standard=2036-character=0A=20=20=20=20=20=20=20=20UUID=20= representation.=0A=20=20=20=20=20=20=20=0A+=20=20=20=20=20=20= =0A+=20=20=20=20=20=20=20=0A+=20=20=20=20=20=20=20=20To=20= maintain=20the=20lexicographical=20sort=20order=20of=20the=20encoded=20= data,=0A+=20=20=20=20=20=20=20=20ensure=20that=20the=20text=20is=20= sorted=20using=20the=20C=20collation=0A+=20=20=20=20=20=20=20=20(e.g.,=20= using=20COLLATE=20"C").=20Natural=20language=0A+=20=20= =20=20=20=20=20=20collations=20may=20sort=20characters=20differently=20= and=20break=20the=20ordering.=0A+=20=20=20=20=20=20=20=0A+=20=20=20= =20=20=20=0A=20=20=20=20=20=20=0A=20=20=20=20=20= =0A=20=0A--=20=0A2.51.2=0A=0A= --Apple-Mail=_6546D7F9-7B07-4BEE-8AF7-A3F0A1664C68 Content-Disposition: attachment; filename=v2-0002-Small-improvements.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="v2-0002-Small-improvements.patch" Content-Transfer-Encoding: quoted-printable =46rom=206a6f4cc5bc2910c9f22c268d1f10a7ac407f6e05=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Andrey=20Borodin=20=0ADate:=20= Thu,=2026=20Mar=202026=2022:55:55=20+0500=0ASubject:=20[PATCH=20v2=20= 2/2]=20Small=20improvements=0A=0A---=0A=20= doc/src/sgml/func/func-binarystring.sgml=20|=206=20+++---=0A=201=20file=20= changed,=203=20insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20= a/doc/src/sgml/func/func-binarystring.sgml=20= b/doc/src/sgml/func/func-binarystring.sgml=0Aindex=20= 9f731d7bca0..dc6b7e57ea7=20100644=0A---=20= a/doc/src/sgml/func/func-binarystring.sgml=0A+++=20= b/doc/src/sgml/func/func-binarystring.sgml=0A@@=20-778,14=20+778,14=20@@=0A= =20=20=20=20=20=20=20=20=0A=20=20= =20=20=20=20=20=20RFC=204648=20Section=207.=20=20It=20uses=20the=20= extended=20hex=20alphabet=0A=20=20=20=20=20=20=20=20= (0-9=20and=0A-=20=20=20=20=20=20=20= A-V)=20which=20preserves=20the=20= lexicographical=0A-=20=20=20=20=20=20=20sort=20order=20of=20the=20= encoded=20data.=20The=20encode=20function=0A+=20=20=20= =20=20=20=20A-V)=20which=20= preserves=20the=20sort=20order=20of=0A+=20=20=20=20=20=20=20the=20= encoded=20data=20when=20compared=20byte-wise.=20The=20= encode=20function=0A=20=20=20=20=20=20=20=20= produces=20output=20padded=20with=20'=3D',=20while=20= decode=0A=20=20=20=20=20=20=20=20accepts=20both=20= padded=20and=20unpadded=20input.=20Decoding=20is=20case-insensitive=20= and=20ignores=0A=20=20=20=20=20=20=20=20whitespace=20characters.=0A=20=20= =20=20=20=20=20=0A=20=20=20=20=20=20=20=0A-=20=20=20=20=20=20= =20This=20format=20is=20useful=20for=20encoding=20UUIDs=20in=20a=20= compact,=20sortable=20format:=0A+=20=20=20=20=20=20=20This=20format=20is=20= useful=20for=20encoding=20UUIDs=20in=20a=20compact,=20byte-wise=20= sortable=20format:=0A=20=20=20=20=20=20=20=20= rtrim(encode(uuid_value::bytea,=20'base32hex'),=20= '=3D')=0A=20=20=20=20=20=20=20=20produces=20a=2026-character=20= string=20compared=20to=20the=20standard=2036-character=0A=20=20=20=20=20=20= =20=20UUID=20representation.=0A--=20=0A2.51.2=0A=0A= --Apple-Mail=_6546D7F9-7B07-4BEE-8AF7-A3F0A1664C68--