Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
Date: 2026-03-26 00:19:03
Message-ID: 01aac5bb-63b1-420f-b396-fdc2027fbb50@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/26/26 00:40, Tom Lane wrote:
> Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> writes:
>> I'm going to push the patch unless there are comments on these changes.
>
> BF member hippopotamus has just demonstrated that this
> "base32hex" representation is not in fact sort-stable at all [1]:
>
> SELECT array_agg(id ORDER BY guid_encoded) FROM guid3;
> array_agg
> ------------------------------
> - {1,2,3,4,5,6,7,8,9,10,11,12}
> + {12,1,2,3,4,5,7,6,8,9,10,11}
> (1 row)
>
> I believe what's happening there is that in cs_CZ locale,
> "V" doesn't follow simple ASCII sort ordering. (I don't
> know the exact rules in Czech, but certainly we've seen
> that locale break a lot of other test queries.)
>

With cs_CZ all letters sort *before* numbers, while in en_US it's the
other way around. V is not special in any way.

> I wonder whether this discovery puts enough of a hole in the
> value-proposition for base32hex that we should just revert
> this patch altogether. "It works except in some locales"
> isn't a very appetizing prospect, so the whole idea is starting
> to feel more like a foot-gun than a widely-useful feature.
>

Seems like that.

regards

--
Tomas Vondra

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2026-03-26 00:28:16 Re: another autovacuum scheduling thread
Previous Message Mark Dilger 2026-03-26 00:01:26 Re: Use CASEFOLD() internally rather than LOWER()