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 1vCMSN-00CpuT-BC for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Oct 2025 18:24:06 +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 1vCMSL-000UUf-9R for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Oct 2025 18:24:04 +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 1vCMSK-000UUW-VY for pgsql-hackers@lists.postgresql.org; Fri, 24 Oct 2025 18:24:04 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vCMSI-003aAX-0t for pgsql-hackers@postgresql.org; Fri, 24 Oct 2025 18:24:03 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-375eff817a3so26284681fa.1 for ; Fri, 24 Oct 2025 11:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761330241; x=1761935041; 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=CZgjV+mHG1wJs1K0z/fGVaiUYtuwimeDlJ9oocHtIJk=; b=CpJp1e/vjCcZFZ+3cKMh7M8WEDNeGaswjhkuwPGTgwywsRzfiaOBauQb+blS4BIqeM LQeX3gyISCRr5/8j/FYirx5LkOH5t35MZwIFk8R01O4muzsjC5N59+TaNXH8V4Xlo1Tw 2yy5wLAn2U2jU+mUv/oizfmlXtxW0eI2n4Wr4LPva3z2oRFMHV9+W9YpaDMI9md5FJz1 DdvIJpt5IO/AsQGalVGA354QMe/F9HZcRM5GCxcsxC6I9wrtVSgpvDvJ2LsyTfUOhV9S QVIba5xWucbmj1HY25euWxFJ0PpF1UjHNQHW4jB7gH7YrmvUke9oJFraa87Gct18BcRO mahw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761330241; x=1761935041; 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=CZgjV+mHG1wJs1K0z/fGVaiUYtuwimeDlJ9oocHtIJk=; b=uGK2wOchRMBE5iwovhLgwCjWNTG/Jk6duqva8SJFR6hQTAE5XJ2AJBGqH844XYz7A2 j4M3sOffcCl13gjXT1p5Hq1g9lzkUSIlyprDCqYArtmZTEpt14C0tekA00hRxo5WB6LW Fb97G8ftziL+n/4I/kFPcqeOJzZ5E5zPks+BLOuFtZZw2zCkD2ItRk25Sg8kEccZU4SH hddDqkbsf0rdB4clrBpb8bbZQxjTebipJVm1INuif33H+NiPHBolXYyTNuS376TuPHEE jDx48rzTe4oBxODqqzQJPQfpgc6kKQ1clS5iGgI2Z45nEOnuhTWSuSk1ypxtNvzzGeA+ EcTQ== X-Forwarded-Encrypted: i=1; AJvYcCW+Q4J+/hcz6LV2qCOQkVDHfYO43Zr/7i20tAznGS59Y28AHzZiE8EvL22Jm66ciqTzDnfL+Zl7bJomXbm3@postgresql.org X-Gm-Message-State: AOJu0Yy0TgKsQgDnNPuFpTjPSRedGvdUTXHrVKNtLwdtYrgjXkhVvD1X bKF/ou/4/O5HSBLArmJ2IwioNMu9cqjxfDTHIX8rJLvT0WFsErHcLqS7s1G8hu92nggGvKBZUVu Jgq9W0sOPgRSG4z6sMcrNxXvCOzSEBKw= X-Gm-Gg: ASbGncubpcqdaaBlfqqooJviD2nPUS4Z5XmUytBF/QUgPE7PSpXyXUXZ6Tx3zF+ZKBK Y4E7ALkQJb63I7tiv8gybLTcjWn1NZL2eGR7Jq5vH8yhziHNt+ZUigCF45u1Za+B9KTUUmGNMbS 5LlJZYNTJFV3LtdxahA/aSU12Dpc4OYYntaNADm9tjfDyPSSuN+9anSNd0j7enKahLP0qOcU41n ZLcVW+qyXGjrA0Iv1cy55QTQNheAucHcIVEl9rWSUmgwrPAEuBtC4jlIe8w4w== X-Google-Smtp-Source: AGHT+IG2ATmsvGA6tQaUqCOCjANADCTwjJAZiONtV+xmHBOyIAaAJdvRzzQN2aQM2f6+wxvCPJK/F+PJjL3h0nJrT8M= X-Received: by 2002:a05:651c:1549:b0:378:d312:52b1 with SMTP id 38308e7fff4ca-378d3125348mr29575051fa.39.1761330240316; Fri, 24 Oct 2025 11:24:00 -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> In-Reply-To: <574624399.175025.1761290201491@mail.yahoo.com> From: Masahiko Sawada Date: Fri, 24 Oct 2025 11:23:23 -0700 X-Gm-Features: AWmQ_bkcN0bxGHIKuXCDRUvFLyV07LTdZwiuF1WYKcoRLQ93NTW7zE7IjPPgBy4 Message-ID: Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions To: Sergey Prokhorenko Cc: Andrey Borodin , 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 Fri, Oct 24, 2025 at 12:17=E2=80=AFAM Sergey Prokhorenko wrote: > > > Masahiko, > > Developers will still be able to use the long canonical 'hex' UUID format= for compatibility. But the short format is not a developer choice, but a c= onvention. We mustn't allow a situation where 25% of systems use base32hex,= 25% use Crocksford's Base32, 25% use base36, and 25% even use erroneously = sorted base64. That's a very real nightmare. You, too, have every reason no= t to want to increase the number of built-in functions in PostgreSQL. > > But here is a solution that I hope will satisfy everyone: > > encode('019535d9-3df7-79fb-b466-fa907fa17f9e', 'uuid_to_base32hex') -> 06= AJBM9TUTSVND36VA87V8BVJO Does it mean the first argument is uuid type data and when 'uuid_to_base32hex' is specified as the format the function requires a uuid data at the first argument? I could not understand the difference between specifying 'based32hex' and 'uuid_to_base32hex' when encoding UUID data with base32hex encoding. > decode('06AJBM9TUTSVND36VA87V8BVJO', 'base32hex_to_uuid') -> 019535d9-3df= 7-79fb-b466-fa907fa17f9e Suppose that the decode() takes text data at the first argument and returns UUID data, the function signature would be decode(text, text) -> uuid. But we cannot create two functions that have the same name and the same argument types. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com