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: Jose Luis Tallon <jltallon@adv-solutions.net>, Alvaro Herrera <alvherre@2ndquadrant.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers <pgsql-hackers@postgresql.org>, Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>, David Fetter <david@fetter.org>
Date: 2019-07-13T15:13:36Z
Lists: pgsql-hackers
Hello Peter,

>> About doc: I'd consider "generation" instead of "generating" as a
>> secondary index term.
>
> We do use the "-ing" form for other secondary index terms.  It's useful
> because the concatenation of primary and secondary term should usually
> make a phrase of some sort.  The alternative would be "generation of",
> but that doesn't seem clearly better.

Ok, fine. I looked but did not find other instances of "generating".

>> What about avoiding a redirection with something like:
>>
>> Datum (* const pg_random_uuid)(PG_FUNCTION_ARGS) = gen_random_uuid;
>
> That seems very confusing.

Dunno. Possibly. The user does not have to look at the implementation, and 
probably such code would deserve a comment.

The point is to avoid one call so as to perform the same (otherwise the 
pg_random_uuid would be slightly slower), and to ensure that it behaves 
the same, as it would be the very same function by construction.

I've switched the patch to ready anyway.

-- 
Fabien.



Commits

  1. Add gen_random_uuid function

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