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-13T06:08:35Z
Lists: pgsql-hackers
Hello Peter,

>>>> A possible option 3 is to keep the function in pgcrypto but change
>>>> its C code to call the core code.
>
> Updated patch with this change included.

Patch applies cleanly, compiles (both pg and pgcrypto). make check (global 
and pgcrypto) ok. Doc generation ok. Minor comments:

About doc: I'd consider "generation" instead of "generating" as a 
secondary index term.

> (There is also precedent for redirecting the extension function to the
> internal one by changing the SQL-level function definition using CREATE
> OR REPLACE FUNCTION ... LANGUAGE INTERNAL.  But that seems more
> complicated and would require a new extension version.  It could maybe
> be included if the extension version is changed for other reasons.)

What about avoiding a redirection with something like:

Datum (* const pg_random_uuid)(PG_FUNCTION_ARGS) = gen_random_uuid;

-- 
Fabien.



Commits

  1. Add gen_random_uuid function

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