pgsql: Add gen_random_uuid function - Mailing list pgsql-committers

From Peter Eisentraut
Subject pgsql: Add gen_random_uuid function
Date
Msg-id E1hmdly-0006iJ-Dn@gemulon.postgresql.org
Whole thread Raw
List 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@cri.ensmp.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(-)


pgsql-committers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: pgsql: Forgotten catversion bump
Next
From: Thomas Munro
Date:
Subject: pgsql: Provide XLogRecGetFullXid().