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 1vE4un-004Mp2-S7 for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Oct 2025 12:04: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 1vE4um-000ZY9-Qw for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Oct 2025 12:04:31 +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 1vE4um-000ZY0-4l for pgsql-hackers@lists.postgresql.org; Wed, 29 Oct 2025 12:04:31 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vE4ui-004NgH-2U for pgsql-hackers@postgresql.org; Wed, 29 Oct 2025 12:04:30 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id E31CDEC0679; Wed, 29 Oct 2025 08:04:27 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 29 Oct 2025 08:04:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1761739467; x=1761825867; bh=wiOdLhvvGTOYjN83VYa9W3sf8op92lD1QGir7OaSzos=; b= RjHPl2kdYVptigJh4jWwh1ojdREcveQi05XGlp+N3VKeBmxOfSZ+PYj+1grEx5Hr sLbxWJb+wtRArM4epNGgD891ORZxtQJRdgvwqbd6PlBMjbXxA+YK562XC+IHbad3 5j+xe0bG9pr5QU8Zr3Q6jZsQ8S6Xtm58GOUXJg4o3lgrFLpmoAkdj/iieXP0Rt7t Ltl3jh++ni+myk9jHKhjOyRoQ/A6M1d2v/WDUQ85rBJoFlmapsf0mf+LaF7rLSN5 +z5B2eKGuPKNbmjUCtOD90KpL4gFaGlpu+R4GAK79/5DllRa+Q1dZbz3+Zh3NiTv HBloWHxC4QZGd9xSmz+eTw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1761739467; x= 1761825867; bh=wiOdLhvvGTOYjN83VYa9W3sf8op92lD1QGir7OaSzos=; b=1 qNVWWT5eUci6FEwF7Sz+Hbd/7RrW3CZj57lRVXoQYHmcEflO8A4kj3dHMyb27YlH Xt9gCw/n+pptF1pSwQuB0jXcG7K280urbh+IGd+r59iqml572w093QouGx2+LzhV nM/WEduFlKCU0JZnsluV2YqFOYLdE/KKItwyTmZD9IqG7CLSvu5yB8U2ITY+6lgP KZdhjCIToiFlgSBkpzurdv+su/PNtxkcMChkuzZyuyhA4QgbSrdgl/yr8PvL8kST DhHWkdeDxgfSCrYx8cxb07p89LV1jJJ8upCyS2sK5oNJCpnS7joSIbJ+19/nC8HZ fLnOKL75fwwDLJnioHSMw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduieefieekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufhffjgfkfgggtgfgsehtkeertddtreejnecuhfhrohhmpeffrghgfhhi nhhnucfklhhmrghrihcuofgrnhhnshonkhgvrhcuoehilhhmrghrihesihhlmhgrrhhird horhhgqeenucggtffrrghtthgvrhhnpedtjeevueejgeejvdffuedujeethffhhefgtdfh ieejffekveekgfdtffejhfdtieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehilhhmrghrihesihhlmhgrrhhirdhorhhgpdhnsggprhgtphht thhopeeipdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehsrgifrggurgdrmhhshh hksehgmhgrihhlrdgtohhmpdhrtghpthhtohepgiegmhhmmheshigrnhguvgigqdhtvggr mhdrrhhupdhrtghpthhtohepshgvrhhgvgihphhrohhkhhhorhgvnhhkoheshigrhhhooh drtghomhdrrghupdhrtghpthhtohepphhoshhtghhrvghssehjvghlthgvfhdrnhhlpdhr tghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhgpd hrtghpthhtoheprghlvghkshgrnhguvghrsehtihhgvghruggrthgrrdgtohhm X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Oct 2025 08:04:26 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Aleksander Alekseev Cc: pgsql-hackers , Jelte Fennema-Nio , Sergey Prokhorenko , Andrey Borodin , Masahiko Sawada Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions 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> <1154454839.957923.1761604611424@mail.yahoo.com> <87ldkv8cog.fsf@wibble.ilmari.org> <87ikfz7zcu.fsf@wibble.ilmari.org> <87frb27zg3.fsf@wibble.ilmari.org> Date: Wed, 29 Oct 2025 12:04:24 +0000 In-Reply-To: (Aleksander Alekseev's message of "Wed, 29 Oct 2025 14:31:29 +0300") Message-ID: <87cy659anr.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Aleksander Alekseev writes: > Hi, > > Thanks for the patch. > >> That does seem like a better fit. It's used mainly in recv functions, >> which this basically is (but user-callable). >> >> Updated patch attaced. > > Perhaps bytea_uuid() should check the UUID format. Consider the > following example: > > SELECT uuid_extract_version('\x019a2f859cedffffb99d9c55044a2563'::bytea::uuid); > uuid_extract_version > ---------------------- > 15 The UUID input function doesn't do any such validation, so I don't see why the cast should behave any differently: # select '019a2f859cedffffb99d9c55044a2563'::uuid; ┌──────────────────────────────────────┐ │ uuid │ ├──────────────────────────────────────┤ │ 019a2f85-9ced-ffff-b99d-9c55044a2563 │ └──────────────────────────────────────┘ # select uuid_extract_version('019a2f859cedffffb99d9c55044a2563'::uuid); ┌──────────────────────┐ │ uuid_extract_version │ ├──────────────────────┤ │ 15 │ └──────────────────────┘ (1 row) > There is no UUID version 15 according to RFC 9562, and the > documentation for uuid_extract_version() says: There's no version 15 specified _yet_. > """ > Extracts the version from a UUID of the variant described by RFC 9562. > For other variants, this function returns null. For example, for a > UUID generated by gen_random_uuid, this function will return 4. > """ > > If I read this correctly, either bytea_uuid() should reject this, or > uuid_extract_version() should be modified to return NULL, or the > documentation for uuid_extract_version() should be altered. Future RFCs could define new versions of this variant, which we should not reject or pretend don't have a version , just because we haven't heard of them yet. In fact, RFC 9562 defines two new versions, v7 and v8, which by this argument PostgreSQL versions before 18 should reject. - ilmari