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 1w3J04-001616-29 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 19:25:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3Iz4-002Bor-0W for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 19:24:42 +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.96) (envelope-from ) id 1w3Iz3-002Boc-2r for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 19:24:42 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3Iz1-000000003bT-1wyS for pgsql-hackers@postgresql.org; Thu, 19 Mar 2026 19:24:42 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5a0fc5e2c59so1175399e87.1 for ; Thu, 19 Mar 2026 12:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773948279; cv=none; d=google.com; s=arc-20240605; b=bqKAbo4kjcNdyK4UusY6qFuD7EYkKvU5RpT6Kt492O3eapbpubF2zSnPU7V9GX2qzp q1YIc98GYEhEcH/SY3dR0cSdbBcfN0hiFrAr25NiqJ5U9Zrn0UgXdAsKTe+svhzQk6Ro GTADyPIAXInZLXnihYYDEKghu+AKVdv4urb3TqDMcFMwJCSWbOTC6FkzcQEA+AiWua1E b6h0CHMLLblL1rW+iZstlNWbqK6aULTzkvjPGDVqAly7PcWcLI/nH9rFZChZaD/1HViq p+NxF/1AXanJq9RyQZx2Zsr3G9XyYNVl8VS3JHIxi5nN8O9yxxnL3+G6ad2bS9r6yRlP IxIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=TwhhmUGC3rjXYNFdUm3mfRS6zyW7IIyKrErVdsw0x14=; fh=iwyycbGkfPxZKFvnKyhsRXlUkYrHc50lre/b1k5wJc8=; b=TMKLl6uHgxAIIhhfe0R14TfPVhgj8e71KxcfGNDQNbzFCHWYuT5LkDWqmKnfwseXe4 jByCdwi9pHGsmq5npLLPFYjIqtj3p/1hBhoHrPSajIpT3KauiBYEpSxxlq+lKqBqEXmn WQ0dBkrRCyA6uSJ908124T09hQnE8Cr7hiOoSuRdDAW2sX2PoIlQ8r/tI67BYsElyRhG EWH/gu6VVQ1w14FYXZ9EcTN9Fus2Hju7kPFJ8osSgkBy3LBdjbgfocqW18w0OV0Gs+aB ga1BwgPKvCGWf2FYIzRM4tHeGXwmOM3iDuxbaF6G9kUr+3ecMLlgEZx1NX2OEuuIr1I2 LMMA==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773948279; x=1774553079; 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=TwhhmUGC3rjXYNFdUm3mfRS6zyW7IIyKrErVdsw0x14=; b=NH+6y9AChB8RlPE0pEV0/srxUS+CusKf8Sk4GpVj1CM+zhTQiQRIFA+fCeK18AdcdQ mlNX2CwGgZKW29zjtmCb71xhUpFpoTVe9q7WHbE2gkfe7nCK1HRaTAn/GEudrBcFIJcb p1bY+DI+ZUPDAnfOAKyCk0WSwBfgcmeTK25rzY5We6+gzoj33qW6AlN5AsQzhaPlvhoi e8Fv36h5oneJ7t7tpdEfGjkubhMbrGqiLQ9G7Ax4zvSDZeRIYKtIxnLonMAOxj+HAUPF ngbolpfiGemaxB/yLzd7AvePHX7GR4RSHCEpdxXRe4OpH6RoQxqmHjQfo9D/dhHXD4MT bQxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773948279; x=1774553079; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TwhhmUGC3rjXYNFdUm3mfRS6zyW7IIyKrErVdsw0x14=; b=mMFwOJgBS6Vx3S0nb70ypsSXnU7UIUMZ0ZGeQ5sVsP5GKhALXLbWLxJ+VELkEAgrBL 1USHCTWBs5vmC2FCBMAAcN4VDmzuq2CQ0hAm8Ss5ABXFycY/17UUWpfFAjmFfeaG74Ic N/uHYduTX7UMdIid/wxKOGfxLgj2TY4r0i77ahZfvpgBzr/ONisrWqZwBwOomMXLF7Qi s4W0D+MUgYDoZZ0WtF66rw2o1sjDb2R5It7rA27wEYelVWkys2lAtF8hI19rVo3TG23l AGiMNUqF4QACRziVmfsk8pVXJVa/NQVi9ZvXMyBw2b3DsQncI5dAGcj8jxa3Uyj4SkK5 3ZAA== X-Gm-Message-State: AOJu0Yw6nIOjSliEQVjfVa0BHUdIQkW+ZIrKHR6hsUvx6NzmrkpxMcmK XeQxq9NDaD7v/tKsW8AmEAvPLpNb5rG9T4NYdq0M4epLEfiTpXHOQzpmnVRu5ESSi0SibCApfpi rKdpGSPfy9AcceGTPGRquA8pJrxjc1iE= X-Gm-Gg: ATEYQzzE9mdwlZls+QX9OqAihKGX0V8FjeV+N1dvlRJUAYudjPbNrzhJYRkaIAxjwcD M33nu5IKz8Y2admC97z7YBM6AxPhT/+QGRyGyrW6mZbPb2HsI2hGDAIF8gGHqeW2YzWGp3U9742 cWQo+KVgKOqQyVAqdGhieXPFbTHjUZhHHPDW3c5FepRkCvlT/Nxkr/vusBd1hPe0AUWKmJ4R3mO gVUMh2IRtz14kPUVhx5kVsf/9DKz6YDsR+sobFSjOXWzsvpHxj7xaCFWJAx+XRio52eSsr8pRVo 5lg9SEQv X-Received: by 2002:a05:6512:31cc:b0:5a1:3ee1:2756 with SMTP id 2adb3069b0e04-5a285ae2a33mr87140e87.4.1773948278496; Thu, 19 Mar 2026 12:24:38 -0700 (PDT) MIME-Version: 1.0 References: <1791665551.452444.1761209220211.ref@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> <1154454839.957923.1761604611424@mail.yahoo.com> <87ldkv8cog.fsf@wibble.ilmari.org> <87ikfz7zcu.fsf@wibble.ilmari.org> <9CB824CC-70DC-4165-AC6A-9664F47209EE@yandex-team.ru> In-Reply-To: From: Masahiko Sawada Date: Thu, 19 Mar 2026 12:24:02 -0700 X-Gm-Features: AaiRm5340phAcDFv9JszFJ_SNkWzQoQBRKvLQ6QDb07_Hdp4gUtfrTRrC7IzLBA Message-ID: Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions To: Aleksander Alekseev Cc: pgsql-hackers , Chengxi Sun , Andrey Borodin , =?UTF-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= 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 Thu, Mar 19, 2026 at 5:19=E2=80=AFAM Aleksander Alekseev wrote: > > Hi, > > > I might be missing some context here, so I wanted to ask: is this behav= ior intentional, > > or would it make sense to enforce stricter validation for Base32hex inp= ut? > > That's intentional - see the discussion above: > > """ > [...] > This code checks if the remaining bits of the input data are all zero. > IIUC we don't have a similar check for base64 and base64url. For > instance, the following input data is accepted: > > =3D# select decode('AB', 'base64'); > decode > -------- > \x00 > (1 row) > """ Right. I've also tested base32hex encoding/decoding with other libraries such as python's one. IIUC our base32hex implementation doesn't necessarily work exactly the same as other libraries to have a better consistency with the existing encodings such as base64 but I believe that it doesn't contradict the RFC. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com