Add gen_random_uuid function
Peter Eisentraut <peter@eisentraut.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| contrib/pgcrypto/pgcrypto.c | modified | +2 −14 |
| doc/src/sgml/datatype.sgml | modified | +2 −10 |
| doc/src/sgml/func.sgml | modified | +26 −0 |
| doc/src/sgml/pgcrypto.sgml | modified | +2 −1 |
| doc/src/sgml/uuid-ossp.sgml | modified | +3 −8 |
| src/backend/utils/adt/uuid.c | modified | +20 −0 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +3 −0 |
| src/test/regress/expected/opr_sanity.out | modified | +1 −0 |
| src/test/regress/expected/uuid.out | modified | +10 −0 |
| src/test/regress/sql/uuid.sql | modified | +6 −0 |
Documentation touched
Discussion
- [PATCH] Implement uuid_version() 36 messages · 2019-04-06 → 2019-09-02