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 1vDTXu-009oyA-IR for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Oct 2025 20:10:25 +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 1vDTXt-0099mH-8T for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Oct 2025 20:10:24 +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 1vDTXs-0099m8-V1 for pgsql-hackers@lists.postgresql.org; Mon, 27 Oct 2025 20:10:23 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vDTXq-0045PH-1A for pgsql-hackers@postgresql.org; Mon, 27 Oct 2025 20:10:23 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-586883eb9fbso6279638e87.1 for ; Mon, 27 Oct 2025 13:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761595821; x=1762200621; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=48qxC91xCPaXRsGUWkROu6zPcJTNuu5nyY/7oC0tIWA=; b=Tsae/VESvXPc8jS4hD/9W5ga2wB76JS6u9wAd9/p1sb7/KZxpu3Z7sp+nSJFJdP4db sCCgJgjauwsfBiz8zrF9Ha3SpnUl9WNKbN06r5Gp5xLuQ73XseOwNeqjwA2wocXh2eHf MOLwROPynESOagNVu+ZZXVTTfBtyDAhYDWQEpcHE255J75Dv3pPVciZLcQ7l+gBnktB5 gP62IJdeXk0lGqwe2Pf8r76liK0wX7bGbtBLc5vY6TghyhJoMC6KoQEgzJLGSE/7HVvY GJUhmkeJsWMumnQps3hklhsnkTeVRwWLbxvIsKWqB93kA1p1LJr+kJWI4SlURAx+7GzX UgSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761595821; x=1762200621; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=48qxC91xCPaXRsGUWkROu6zPcJTNuu5nyY/7oC0tIWA=; b=e6a+oTybGrZctKkACcKX2FOikYtFTKsX8sH42UEEvDQjFvqnDAWcFbDbC6UnBfGYnD uub6oSBTbPxaflIl5f0m7VESpuoMJXSsjHO3psEcHCLKiptQne7pH8t5ktZ8GRCcKbA2 IQWe6RVF6+vdUtfTToIRs1IHdSUwTwnIctkpgfZ6dcHdQGJofmPnwCGdpPIHuRuRhbJe RoFiKbP8PKnJZGe/PoGjgsPqbOzbarab7eQp2ud3S4B4idhXqQnxyFlzm8Imxp+TR2IU j45cOPzf/uQqel1/2tUmPcko5I12E+KorgIXYmqGjWSQiYI40jfhtwX6wEeVkynJnBFQ /ryw== X-Forwarded-Encrypted: i=1; AJvYcCXXjBSkcCg3E1zfwLx2YoFXFM0ksFbq0a9mxpHjJvJEJWGnjveldXgTkSVw3Sy+qdj/6Z/NmqDo2a3vf42d@postgresql.org X-Gm-Message-State: AOJu0Yw2gni1PIWE2nA0ym+gNEMNGl5Gelw3wcIi0+A1OzFji3rg5i9E ilk3W8J9k/B13Z6dgcXgfNrj8CyvCOwKIGOt+PxZdIJjoBuEAjYHs2/jtdlLkvdkyGVLWPSFrMb Sn/sBLcAYYtKNK5+H+qxJmcLjySEWBNY= X-Gm-Gg: ASbGncuHoAbdRCBU6JtuyJCC6gNkG/g4HBYT1CISMxDAFczm7Q6UYbAY91ZfG09Gk9r ZyPjjoRcQCZmrgENXo4cTK/Y12W2djlSXdq1uSyjcDOfdqR08J7lizbQEpxN/m9gtCO2Gdin28N ZQCyBM4zKlDtb4wrX+l+qaR6d/Q6/tl1YdEwzsHJMkJVsiZMy+WiuBHwStVepX9LRcPKmoJvX3n BvE+6AuJYBMDfWb3CIeDfPiLqGL0xZWLT1NOdz+EmqwCQRx3H37tYkBlVZRMA== X-Google-Smtp-Source: AGHT+IHh8TIKs7meNiPKSPv3lz9WuAC84zanpbll99D/ZO5qoBnaJ2rCKq6MWKjEc9yTsl57fenVH7W0MUNY2GKBzqQ= X-Received: by 2002:a05:6512:3daa:b0:593:835:d703 with SMTP id 2adb3069b0e04-5930e993997mr381798e87.12.1761595820467; Mon, 27 Oct 2025 13:10:20 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <6F76FA61-E2DC-44EF-9504-889D9BDB4EBD@yandex-team.ru> From: Masahiko Sawada Date: Mon, 27 Oct 2025 13:09:43 -0700 X-Gm-Features: AWmQ_bklbZSZSmw-wqlGSh5voG-EyT7sNQtoIYlWyOa6Kim8M9EjDn1yXXZN7jY Message-ID: Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions To: Andrey Borodin Cc: Sergey Prokhorenko , pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Oct 25, 2025 at 11:07=E2=80=AFAM Andrey Borodin wrote: > > > > > On 25 Oct 2025, at 04:31, Masahiko Sawada wrote= : > > > > 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... Thank you for drafting the patch! But I find it potentially confusing to have different encoding methods for bytea and UUID types. I don't see a compelling reason why the core should support base32hex exclusively for the UUID data type, nor why base32hex should be the only encoding method that the core provides for UUIDs (while we can use it by default). If we implement uuid_encode() and uuid_decode(), we might end up creating similar encoding and decoding functions for other data types as well, which doesn't seem like the best approach. I still believe that extending the existing encode() and decode() functions is a better starting point. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com