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 do I use PostgreSQL ZonedDateTime to store date and time information?
- How can Zalando use PostgreSQL to improve its software development?
- How can I use PostgreSQL with Zabbix?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I use PostgreSQL and ZFS snapshots together?
- How can I use PostgreSQL with YAML?
- How do I parse XML data using PostgreSQL?
- How do I store an array in a PostgreSQL database?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I use PostgreSQL's XMIN and XMAX features?
See more codes...