gen_random_uuid()

A system function to generate a random UUID

gen_random_uuid() is a system function which generates a random UUID.

gen_random_uuid() was added in PostgreSQL 13.

Change history

Note: gen_random_uuid() was previously available via the pgcrypto contrib module; as of PostgreSQL 13, the function provided by pgcrypto has become a wrapper around the core gen_random_uuid() function.

Examples

postgres=# SELECT gen_random_uuid();
           gen_random_uuid            
--------------------------------------
 32165102-4866-4d2d-b90c-7a2fddbb6bc8
(1 row)

Categories

DDL, System function

See also

uuid-ossp