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 1vBv25-006qmH-Sn for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Oct 2025 13:07:09 +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 1vBv24-008iMt-Qk for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Oct 2025 13:07:07 +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.94.2) (envelope-from ) id 1vBv24-008iMk-HS for pgsql-hackers@lists.postgresql.org; Thu, 23 Oct 2025 13:07:07 +0000 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vBv20-003Lv6-0v for pgsql-hackers@postgresql.org; Thu, 23 Oct 2025 13:07:06 +0000 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:7888:0:640:a8fd:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 3C4F2C0215; Thu, 23 Oct 2025 16:06:56 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6bf:8080:d2d::1:11]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id s6YpE70F80U0-YzVuMvcI; Thu, 23 Oct 2025 16:06:55 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1761224815; bh=XKoN1mN16sav7HMgHj6bBvYx1u3FO92YyybgxD9QsuI=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=BuUwJMNdUl2x8G81tXmO5/YQGsYd0/xA1A6AQEOweXg9cjEDwUVowg2cQeY2emGNI nKJOw6QusLszWfRTY+0RJqoa2wm5cDsOyvUYbWuTaaBL5+3zyc8MR5qi744pPPvGPG WWl/1s1T47gS3shTUVjmQ8QYWMT9HB7hdesL9MwQ= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions From: Andrey Borodin In-Reply-To: Date: Thu, 23 Oct 2025 18:06:43 +0500 Cc: pgsql-hackers , Sergey Prokhorenko Content-Transfer-Encoding: quoted-printable Message-Id: <18022523-0F8F-4C07-AFF5-57DC9086D78E@yandex-team.ru> References: <1791665551.452444.1761209220211.ref@mail.yahoo.com> <1791665551.452444.1761209220211@mail.yahoo.com> To: Aleksander Alekseev X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello! > On 23 Oct 2025, at 14:55, Aleksander Alekseev = wrote: >=20 > Secondly, in order to propose a patch please use `git format-patch` > and send it as an attachment. Then register it on the nearest open > commitfest [1]. I think it's not about review yet, but more of a discussing viability = and general approach. The code itself is trivial in this case. My first reaction was very skeptical too. Yes, this representation = (28V4APV8JC9D792M89J185Q000) seems more developer-friendly than default = (123e4567-e89b-12d3-a456-426614174000). But why should we bother with = propagating one data format over another? Yet, this format is RFC-blessed. It makes sense to consider providing an = alternative to unfriendly format. > The interface you are proposing is ugly and is not composable. The > right way of doing this IMO would be: >=20 > 1. Implement uuid -> bytea and bytea -> uuid casting > 2. Implement encode(bytea, 'base32') and decode(text, 'base32') >=20 > So the overall interface should be like this: >=20 > SELECT encode(uuidv7() :: bytea, 'base32'); That's an excellent feedback! Would such conversion be idiomatic for = Postgres users? Are there any other alternative approaches? > The value of converting uuid to base32 is not obvious though, so I > would recommend explaining it in more detail. Yes, and maybe some examples of other systems that adopted this format = would be handy too. Sergey, can you, please, extend reasoning why this = particular format is prominent? RFC 4648 describes a bunch of formats. > Consider starting a new > thread for each separate patch. I think this thread is fine for discussing. Thank you! Best regards, Andrey Borodin.=