| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | Aleksander Alekseev <aleksander(at)tigerdata(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
| Subject: | Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions |
| Date: | 2026-03-18 17:52:30 |
| Message-ID: | CAD21AoC2Ooy=W=4YjQ_GO5nEYZ2tsn43=TkLf7ysE-96ygohKg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Mar 18, 2026 at 4:14 AM Aleksander Alekseev
<aleksander(at)tigerdata(dot)com> wrote:
>
> Hi,
>
> > I've attached a patch for the 0002 patch part that fixes the above
> > points (except for the last point) and has some minor fixes as well.
>
> Applied, thanks.
>
> > + /* Verify no extra bits remain (padding bits should be zero) */
> > + if (bits_in_buffer > 0 && (bits_buffer & ((1ULL << bits_in_buffer)
> > - 1)) != 0)
> > + ereport(ERROR,
> > + (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> > + errmsg("invalid base32hex end sequence"),
> > + errhint("Input data has non-zero padding bits.")));
> >
> > 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:
> >
> > =# select decode('AB', 'base64');
> > decode
> > --------
> > \x00
> > (1 row)
> >
> > I think it's better to have consistent behavior across our encoding.
>
> Agree. Fixed.
Thank you for updating the patches!
I've made some minor changes to both patches (e.g., rewording the
documentation changes and commit messages etc), and attached the
updated patches.
I'm going to push these patches unless there is no further comment.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v7-0002-Add-base32hex-support-to-encode-and-decode-functi.patch | text/x-patch | 15.8 KB |
| v7-0001-Allow-explicit-casting-between-bytea-and-uuid.patch | text/x-patch | 6.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dave Cramer | 2026-03-18 18:00:25 | Re: Proposal to allow setting cursor options on Portals |
| Previous Message | Robert Haas | 2026-03-18 17:46:14 | Re: dshash_find_or_insert vs. OOM |