BUG #14670: uuid_generate_v3 and uuid_generate_v5 do not support binary names

Started by Nonamealmost 9 years ago5 messagesbugs
Jump to latest
#1Noname
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

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Noname (#1)
Re: BUG #14670: uuid_generate_v3 and uuid_generate_v5 do not support binary names

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.

#3Mohamed Akram
mohd.akram@outlook.com
In reply to: David G. Johnston (#2)
Re: BUG #14670: uuid_generate_v3 and uuid_generate_v5 do not support binary names

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<mailto:david.g.johnston@gmail.com>> wrote:

On Wed, May 24, 2017 at 1:46 PM, <mohd.akram@live.com<mailto: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<mailto: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.

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mohamed Akram (#3)
Re: BUG #14670: uuid_generate_v3 and uuid_generate_v5 do not support binary names

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

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

#5Mohamed Akram
mohd.akram@outlook.com
In reply to: Tom Lane (#4)
Re: BUG #14670: uuid_generate_v3 and uuid_generate_v5 do not support binary names

I’ve attached a patch for this.

Regards,
Mohamed

Show quoted text

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

Attachments:

uuid-bytea.diffapplication/octet-stream; name=uuid-bytea.diffDownload+84-4