Contents
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.
Usage
gen_random_uuid () → uuid
Change history
- PostgreSQL 13
- added (commit 5925e554)
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
Basic usage example for gen_random_uuid()
:
postgres=# SELECT gen_random_uuid(); gen_random_uuid -------------------------------------- 32165102-4866-4d2d-b90c-7a2fddbb6bc8 (1 row)
References
- PostgreSQL documentation: gen_random_uuid()