Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
Date
Msg-id CAJ7c6TPu7NGrSj-V2-ns0GTNGx9cmoKQgzt-p2MpJepiGjQnYw@mail.gmail.com
Whole thread
In response to Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
List pgsql-hackers
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.

-- 
Best regards,
Aleksander Alekseev

Attachment

pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Avoid some table rewrites for ALTER TABLE .. SET DATA TYPE array coerce
Next
From: Dmitry Dolgov
Date:
Subject: Re: Add ssl_(supported|shared)_groups to sslinfo