Re: [PATCH] Implement uuid_version()

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>, David Fetter <david@fetter.org>, Tom Lane <tgl@sss.pgh.pa.us>, Jose Luis Tallon <jltallon@adv-solutions.net>
Date: 2019-06-30T13:50:15Z
Lists: pgsql-hackers
Hello Peter,

>> Yeah, I think implementing a v4 generator in core would be trivial and
>> address almost everyone's requirements.
>
> Here is a proposed patch for this.  I did a fair bit of looking around
> in other systems for a naming pattern but didn't find anything
> consistent.  So I ended up just taking the function name and code from
> pgcrypto.
>
> As you can see, the code is trivial and has no external dependencies.  I
> think this would significantly upgrade the usability of the uuid type.

Patch applies cleanly.

However it does not compile, it fails on: "Duplicate OIDs detected: 3429".

Someone inserted a new entry since it was produced.

I'm wondering whether pg_random_uuid() should be taken out of pgcrypto if 
it is available in core?

-- 
Fabien.



Commits

  1. Add gen_random_uuid function

  2. Add a 64-bit hash function for type hstore.