4 ms·
> PostgreSQL has built in support for UUIDv4 through the pgcrypto or the uuid-ossp extensions. Do note that postgres supports generating UUIDv4 without any ext
by jrochkind1 4y ago
> PostgreSQL has built in support for UUIDv4 through the pgcrypto or the uuid-ossp extensions.
Do note that postgres supports generating UUIDv4 without any extension, via the `gen_random_uuid ` function, since PG 13. (released sep 2020).
A lot of people still haven't realized this! (Apparently including OP author!)
There are some circumstances where even loading built-in extensions is inconveient. (Some people have told me their container-based setup makes this infeasible, I don't totally understand why, it's not not my use case, but just in case...) But no extension necessary for UUIDv4 in postgres 13 and following!
- tzot 4y ago> Do note that postgres supports generating UUIDv4 without any extension, via the `gen_random_uuid ` function, since PG 13. (released sep 2020). > A lot of people still haven't realized this! (Apparently including OP author!) A lot of people still use pre-PG13 versions (maybe including OP author).