Обсуждение: [BUGS] BUG #14670: uuid_generate_v3 and uuid_generate_v5 do not supportbinary names

Поиск
Список
Период
Сортировка

[BUGS] BUG #14670: uuid_generate_v3 and uuid_generate_v5 do not supportbinary names

От
mohd.akram@live.com
Дата:
The following bug has been logged on the website:

Bug reference:      14670
Logged by:          Mohamed Akram
Email address:      mohd.akram@live.com
PostgreSQL version: 9.6.3
Operating system:   macOS 10.12.5
Description:

As per RFC 4122 - https://tools.ietf.org/html/rfc4122#section-4.3 - name
should not be limited to textual data.


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [BUGS] BUG #14670: uuid_generate_v3 and uuid_generate_v5 do notsupport binary names

От
"David G. Johnston"
Дата:
On Wed, May 24, 2017 at 1:46 PM, <mohd.akram@live.com> wrote:
The following bug has been logged on the website:

Bug reference:      14670
Logged by:          Mohamed Akram
Email address:      mohd.akram@live.com
PostgreSQL version: 9.6.3
Operating system:   macOS 10.12.5
Description:

As per RFC 4122 - https://tools.ietf.org/html/rfc4122#section-4.3 - name
should not be limited to textual data.

​Since it says should and not must an implementation that restricts the name to be textual is still conforming.

Apart from that supplying an SQL example of what you want to work and what happens when it fails would reduce the possibility of mis-understanding what it is you are saying.​

David J.

Re: [BUGS] BUG #14670: uuid_generate_v3 and uuid_generate_v5 do notsupport binary names

От
Mohamed Akram
Дата:
That’s true, I guess it’s more of an enhancement but I couldn’t find an option for that in the bug form. However, even the sample C code in the RFC takes a void* argument for name.

My use case is generating unique identifiers for images, similar to:

select uuid_generate_v5(namespace, data);

where data is a bytea column.

I know I can convert to base64, but I’d rather not.

On May 25, 2017, at 1:26 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:

On Wed, May 24, 2017 at 1:46 PM, <mohd.akram@live.com> wrote:
The following bug has been logged on the website:

Bug reference:      14670
Logged by:          Mohamed Akram
Email address:      mohd.akram@live.com
PostgreSQL version: 9.6.3
Operating system:   macOS 10.12.5
Description:

As per RFC 4122 - https://tools.ietf.org/html/rfc4122#section-4.3 - name
should not be limited to textual data.

​Since it says should and not must an implementation that restricts the name to be textual is still conforming.

Apart from that supplying an SQL example of what you want to work and what happens when it fails would reduce the possibility of mis-understanding what it is you are saying.​

David J.


Mohamed Akram <mohd.akram@outlook.com> writes:
> That’s true, I guess it’s more of an enhancement but I couldn’t find an option for that in the bug form. However,
eventhe sample C code in the RFC takes a void* argument for name.
 
> My use case is generating unique identifiers for images, similar to:
> select uuid_generate_v5(namespace, data);
> where data is a bytea column.

A little experimentation suggests that we might be able to add a function
uuid_generate_v3(uuid, bytea) alongside the uuid_generate_v3(uuid, text)
one without creating serious problems --- in ambiguous situations, it
seems the text one would be preferred, so we'd not break existing queries.

I have no interest in preparing such a patch myself, though.
        regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [BUGS] BUG #14670: uuid_generate_v3 and uuid_generate_v5 do notsupport binary names

От
Mohamed Akram
Дата:
I’ve attached a patch for this.

Regards,
Mohamed


> On May 25, 2017, at 2:48 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Mohamed Akram <mohd.akram@outlook.com> writes:
>> That’s true, I guess it’s more of an enhancement but I couldn’t find an option for that in the bug form. However, even the sample C code in the RFC takes a void* argument for name.
>> My use case is generating unique identifiers for images, similar to:
>> select uuid_generate_v5(namespace, data);
>> where data is a bytea column.
>
> A little experimentation suggests that we might be able to add a function
> uuid_generate_v3(uuid, bytea) alongside the uuid_generate_v3(uuid, text)
> one without creating serious problems --- in ambiguous situations, it
> seems the text one would be preferred, so we'd not break existing queries.
>
> I have no interest in preparing such a patch myself, though.
>
>                        regards, tom lane

Вложения