postgresqlHow do I generate a UUID in PostgreSQL?
You can generate a UUID in PostgreSQL using the uuid_generate_v4()
function. This function generates a version 4 UUID, which is a randomly generated UUID.
Example
SELECT uuid_generate_v4();
Output example
7c9f2a8d-6d5f-4ce3-b9f7-5e7d6f8c3d02
The uuid_generate_v4()
function has the following parts:
uuid_generate_v4()
: The function name.SELECT
: The keyword used to query the database.
More information about the uuid_generate_v4()
function can be found in the PostgreSQL documentation.
More of Postgresql
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL and ZFS snapshots together?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I monitor PostgreSQL performance using Zabbix?
- How can I use PostgreSQL's "zero if null" feature?
- How can I set a PostgreSQL interval to zero?
- How can I use PostgreSQL with YAML?
- How can I retrieve data from PostgreSQL for yesterday's date?
- How do I use PostgreSQL's XMIN and XMAX features?
- How do I set the PostgreSQL work_mem parameter?
See more codes...