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.94.2) (envelope-from ) id 1vDNoq-007zr5-LQ for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Oct 2025 14:03:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vDNon-007r5e-QA for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Oct 2025 14:03:28 +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.94.2) (envelope-from ) id 1vDNom-007r5V-Fc for pgsql-hackers@lists.postgresql.org; Mon, 27 Oct 2025 14:03:28 +0000 Received: from sonic303-24.consmr.mail.gq1.yahoo.com ([98.137.64.205]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vDNog-004V7G-0v for pgsql-hackers@postgresql.org; Mon, 27 Oct 2025 14:03:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.au; s=s2048; t=1761573793; bh=5Ii8Fa0+dE8gMzLyHuL9hI0XMO9wq8UCYgb9Pvd9XTA=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To; b=VBQNkoGupAm5LZZWXZVArnvUsIGUPp5Hm0qFgL+c04UIF5NN7e0Xj2SESpvgzzVQ6S5W3qxJDyN1cLHmnQHENrUsiSUSxNgsJ+MYzEQl6PIauJgH14ovsDcCKwVbgKlnNvWzokOTLDu2ueybeMhuH7yXiwjhC3/hhEK0m7+wg2rplGiunNnHps8/mzvjJFX7De74wNBhLNiRNZ5LYbzbBopyx3JTZiiozHvRM023yshFwVyeCDdoPcu7QfYhsqyybwBiyj/VfP9lOfoS5YF1pM74BkKlJMTqzyq48Xc3DcSgMZElHI0nCberYKFT1D/4ct73/VGGADeU8Wf1eL2kww== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1761573793; bh=1Dyu1gMhPxcm96wpandTHXT+y9wfJmKUEkSLBpq7TBo=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=IjAaP2mxEvAuFLZybDpwgeqJovJzejGY3Nuwo4hAxm3xxg/1jNl+OibLqxqh38CLTLYYkWBCN8NYizBpcHVUm+DZqLFaRg3D5dIsv5KOoSywT0xN08HigygFGS6HdYxlT5o+xq0uxX3iAjgUGzQ0Krbdemyie5qEYETTUinN9prumgM5/pxfNzXv9/4kLpPona2N1bjTtOblAg6AS7YLSAgqhjw47qoxAiwQQJRXyGOcTODgQH+6UAVKm1GemQh1Q7eIVdSlSjrYxsABMRNYYo/BPYr5d7/fSIwRSOMP7Pi2bGHPc1wlP1g7ZOAoJDiEFTwS1oNNK83wmHw++4osfg== X-YMail-OSG: U0Uai4MVM1k.nHTvJ_ML0pcJb5iJmwrD9zzDw8FRJuGPklmxmGg3CyvhLmKmqK8 GNnqUZBQhX30Jevo5wgJxDpCnJJ9oIo1wDWc6ShrPiRiSigf1SMqR32tV6bvCA20X4IlNtB5a3Kc P2m2TMMxijm3FgrA8_nmhBgoAYP9W78z49ovFlJ5FkBkEyhmaPkPxsIwlmNhAlEVvBIVp7NYZQdJ N1d.qShphGBYS9Qaokor3CEL807LK9wFbD0MLaBV2OH1yY05ghzzBBOp9Xjg1.1zf8DbMzhC9RaM Pl8A8xYtAr8ne.U0BacRq2EOksEAtJ7TS8bvzQu3A9KcyYVNVzbs8ElHDLCeE_4YVnwz3RlCq96G 5wHNtaLb90I0ENmXHGwpOvD5HCsErCHPjUH_FtBuhddfF7bFcplMD1eMqsYsUY130H0ZmyXtCNSq gqoBKqPFWSIxAy66zoG1QxKifYzZIiUkZRtgtz1EDQcB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AWZAZ1oUkro86Buo750sP.7 BX01Uyy6Z3CQLy6PMyPzoYVCzhZTEFbx5PB7T3fThznETgiXAyLF4z.izJEAhmGQnVF4gS8KUx5o o0e43sfpzhDV8jyfZxnYIgiayJSnAhch6k1AIOcPYQ.Xl8m8H3mZEq4Tig7inGzr0tmktOX2g78H vaP28ln_d9hA.CH45pWZcc8j6qoc2TaOBJ5YAPpu454d9V7bSSdWbg.8dAb1qk4abcZEWOZqvocW ECyWBKWntJD6FWc_mCUdExQkplpksfI1aXITmEefmVeuLHKUytIAzkUIFDt6xjY3IqD6ow8JYTJK eghIniNDVqzviKbc0DWc_ehdPCkDq6Qcg.zmdo3NE1f1R3KKvPhIdAiVSM1nmG6S7mtyyiULfPWa PhIKI8yp2pLM6RDrQsMK1fO.Gdu5npeLX2mpUcEbS2UNIjSfb8wlzwTEEZWOJpR.E_Mn1jx.VpUy vvX.V1F0A4.b1EB5ThY6q22MYuXNE3EdWKLH4pCdJo4Fjmh82Zy79x1cpc0Y7VfJCLZVrtmSX7OI DO8xyPzU34glqGyQcmvW_17MgTiXlmBRgRkv.0sN6wlhbGdWt5gfVN_kK73D1sA953W.CLxBz1RD 11YQs3q_O3j5o2kxdp9f1pf96vupLsWNiuNvj.SgQp2a0xrXUydV_LgagiYXeQK9SsoOIH5f3UUM fhk4mYUDEgtf6dSePUgi3TCcyJ60dAURhNgtoCwmPtr9JTxlnrRWFuMkb.I4smBK9G7hP_rHpFVS 6F3rSdJ8hpPO1KJIrY8PXAiktGvjWCAU17JXhLtlx.s40Mb8- X-Sonic-MF: X-Sonic-ID: 907ded26-2fd0-4f9b-95fc-811a925c58dc Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.gq1.yahoo.com with HTTP; Mon, 27 Oct 2025 14:03:13 +0000 Date: Mon, 27 Oct 2025 14:03:09 +0000 (UTC) From: Sergey Prokhorenko To: pgsql-hackers , Aleksander Alekseev Cc: Andrey Borodin , Masahiko Sawada Message-ID: <1228470163.787783.1761573789233@mail.yahoo.com> In-Reply-To: References: <1791665551.452444.1761209220211.ref@mail.yahoo.com> <1791665551.452444.1761209220211@mail.yahoo.com> <18022523-0F8F-4C07-AFF5-57DC9086D78E@yandex-team.ru> <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> Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_787782_415956227.1761573789232" X-Mailer: WebService/1.1.24652 YMailNorrin Content-Length: 6381 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_787782_415956227.1761573789232 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, > > Or providing > > 'uuid_encode(uuid, format text) -> text' and 'uuid_decode(text, format > > text) -> uuid' might make sense too, but I'm not sure. > > I like the idea, so I drafted a prototype for discussion. > Though I do not see what else methods should be provided along with added= one... I see no reason why we should forbid the use of base32 encoding with bytea. Or have different functions for this e.g. uuid_encode() and encode(). To me it looks like a poor API design. --=20 Best regards, Aleksander Alekseev ____________________________________________ It seems that bytea is your personal interest, since you continue to impose= your bytea when a better solution has already been found with uuid_encode(= ) and uuid_decode(). The bytea proposal has a lot of drawbacks: 1. It requires unnecessary casting in addition to encoding/decoding. This c= omplicates the interface and creates unnecessary cognitive load on develope= rs. It also creates additional CPU load, although perhaps only a small amou= nt. 2. The encoding function encourages developers to use the slightly more com= pact base64 encoding (see=C2=A0https://www.postgresql.org/docs/current/func= tions-binarystring.html), which doesn't preserve sort order, isn't URL-safe= , is case-sensitive, and requires specifying the case of letters when dicta= ting. This also creates a serious problem of incompatibility between UUID e= ncodings. 3. The hashing functions used by bytea create a temptation to implement pop= ular, idiotic ideas for hashing UUIDs to obscure their creation date and to= hide internal keys from clients. 4. Other various functions for bytea allow the construction of Frankenstein= =C2=A0identifiers that compete with UUIDv7, which could negatively impact t= he reputation of UUIDs. The bytea type has nothing in common with the uuid type other than the bina= ry encoding. Therefore, the bytea <-> uuid cast can only encourage abuse an= d errors, creating the illusion of unlimited developer power. The bytea proposal has no merit whatsoever. It's the worst, most insafe, an= d most harmful design, undermining efforts to widely adopt UUIDv7 and impro= ve PostgreSQL. =20 ------=_Part_787782_415956227.1761573789232 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

> > Or providing
> > = 'uuid_encode(uuid, format text) -> text' and 'uuid_decode(text, format> > text) -> uuid' might make sense too, but I'm = not sure.
>
> I like the idea, so= I drafted a prototype for discussion.
> Though I do n= ot see what else methods should be provided along with added one...

I see no reason why we should forbid the use = of base32 encoding with
bytea. Or have different function= s for this e.g. uuid_encode() and
encode(). To me it look= s like a poor API design.


--
Best regards,

Aleksander Alekseev

______= ______________________________________


It seems that bytea is your pe= rsonal interest, since you continue to impose your bytea when a better solu= tion has already been found with uuid_encode() and uuid_decode().


The bytea proposal has a lot of drawbacks:

1. It requires unnecessary casting in addition t= o encoding/decoding. This complicates the interface and creates unnecessary= cognitive load on developers. It also creates additional CPU load, althoug= h perhaps only a small amount.


2. The encoding function encourages develope= rs to use the slightly more compact base64 encoding (see https://www.postgresql.org/docs/current/function= s-binarystring.html), which doesn't preserve sort order, isn't URL-safe= , is case-sensitive, and requires specifying the case of letters when dicta= ting. This also creates a serious problem of incompatibility between UUID e= ncodings.


3. The hashing functions used by bytea create a temptation= to implement popular, idiotic ideas for hashing UUIDs to obscure their cre= ation date and to hide internal keys from clients.


4. Other various functions for bytea allow the construction of Frank= enstein identifiers that compete with UUIDv7, which could negat= ively impact the reputation of UUIDs.


The bytea ty= pe has nothing in common with the uuid type other than the binary encoding.= Therefore, the bytea <-> uuid cast can only encourage abuse and erro= rs, creating the illusion of unlimited developer power.


<= span>The bytea proposal has no merit whatsoever. It's the worst, most insaf= e, and most harmful design, undermining efforts to widely adopt UUIDv7 and = improve PostgreSQL.




------=_Part_787782_415956227.1761573789232--