PostgreSQL 13 supports natively gen_random_uuid ():
PostgreSQL includes one function to generate a UUID:
gen_random_uuid () ? uuid
This function returns a version 4 (random) UUID. This is the most commonly used type of UUID and is appropriate for most applications.