pgsql: Add gen_random_uuid function

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add gen_random_uuid function
Date: 2019-07-14 12:38:34
Message-ID: E1hmdly-0006iJ-Dn@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add gen_random_uuid function

This adds a built-in function to generate UUIDs.

PostgreSQL hasn't had a built-in function to generate a UUID yet,
relying on external modules such as uuid-ossp and pgcrypto to provide
one. Now that we have a strong random number generator built-in, we
can easily provide a version 4 (random) UUID generation function.

This patch takes the existing function gen_random_uuid() from pgcrypto
and makes it a built-in function. The pgcrypto implementation now
internally redirects to the built-in one.

Reviewed-by: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Discussion: https://www.postgresql.org/message-id/6a65610c-46fc-2323-6b78-e8086340a325@2ndquadrant.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5925e5549890416bcf588334d9d0bc99f8ad6c7f

Modified Files
--------------
contrib/pgcrypto/pgcrypto.c | 16 ++--------------
doc/src/sgml/datatype.sgml | 12 ++----------
doc/src/sgml/func.sgml | 26 ++++++++++++++++++++++++++
doc/src/sgml/pgcrypto.sgml | 3 ++-
doc/src/sgml/uuid-ossp.sgml | 11 +++--------
src/backend/utils/adt/uuid.c | 20 ++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 3 +++
src/test/regress/expected/opr_sanity.out | 1 +
src/test/regress/expected/uuid.out | 10 ++++++++++
src/test/regress/sql/uuid.sql | 6 ++++++
11 files changed, 76 insertions(+), 34 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2019-07-15 05:08:05 pgsql: Provide XLogRecGetFullXid().
Previous Message Alexander Korotkov 2019-07-14 12:29:33 Re: pgsql: Forgotten catversion bump