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's XMLTABLE to parse XML data?
- How do I use PostgreSQL's XMIN and XMAX features?
- How do I set the PostgreSQL work_mem parameter?
- How do I use PostgreSQL with Qt?
- How do I use PostgreSQL's ON CONFLICT DO NOTHING clause?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I export data from PostgreSQL to an XML file?
- How can I use PostgreSQL for my project?
- How can I use PostgreSQL substring functions?
- How do I create a PostgreSQL trigger?
See more codes...