]> begriffs open source - ai-pg/blob - full-docs/src/sgml/html/datatype-uuid.html
WIP: toc builder
[ai-pg] / full-docs / src / sgml / html / datatype-uuid.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>8.12. UUID Type</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="datatype-textsearch.html" title="8.11. Text Search Types" /><link rel="next" href="datatype-xml.html" title="8.13. XML Type" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">8.12. <acronym class="acronym">UUID</acronym> Type</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="datatype-textsearch.html" title="8.11. Text Search Types">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="datatype.html" title="Chapter 8. Data Types">Up</a></td><th width="60%" align="center">Chapter 8. Data Types</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="datatype-xml.html" title="8.13. XML Type">Next</a></td></tr></table><hr /></div><div class="sect1" id="DATATYPE-UUID"><div class="titlepage"><div><div><h2 class="title" style="clear: both">8.12. <acronym class="acronym">UUID</acronym> Type <a href="#DATATYPE-UUID" class="id_link">#</a></h2></div></div></div><a id="id-1.5.7.20.2" class="indexterm"></a><p>
3     The data type <code class="type">uuid</code> stores Universally Unique Identifiers
4     (UUID) as defined by <a class="ulink" href="https://datatracker.ietf.org/doc/html/rfc9562" target="_top">RFC 9562</a>,
5     ISO/IEC 9834-8:2005, and related standards.
6     (Some systems refer to this data type as a globally unique identifier, or
7     GUID,<a id="id-1.5.7.20.3.3" class="indexterm"></a> instead.)  This
8     identifier is a 128-bit quantity that is generated by an algorithm chosen
9     to make it very unlikely that the same identifier will be generated by
10     anyone else in the known universe using the same algorithm.  Therefore,
11     for distributed systems, these identifiers provide a better uniqueness
12     guarantee than sequence generators, which
13     are only unique within a single database.
14    </p><p>
15     RFC 9562 defines 8 different UUID versions.  Each version has specific requirements
16     for generating new UUID values, and each version provides distinct benefits and drawbacks.
17     <span class="productname">PostgreSQL</span> provides native support for generating UUIDs
18     using the UUIDv4 and UUIDv7 algorithms.  Alternatively, UUID values can be generated
19     outside of the database using any algorithm.  The data type <code class="type">uuid</code> can be used
20     to store any UUID, regardless of the origin and the UUID version.
21    </p><p>
22     A UUID is written as a sequence of lower-case hexadecimal digits,
23     in several groups separated by hyphens, specifically a group of 8
24     digits followed by three groups of 4 digits followed by a group of
25     12 digits, for a total of 32 digits representing the 128 bits.  An
26     example of a UUID in this standard form is:
27 </p><pre class="programlisting">
28 a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
29 </pre><p>
30     <span class="productname">PostgreSQL</span> also accepts the following
31     alternative forms for input:
32     use of upper-case digits, the standard format surrounded by
33     braces, omitting some or all hyphens, adding a hyphen after any
34     group of four digits.  Examples are:
35 </p><pre class="programlisting">
36 A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11
37 {a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}
38 a0eebc999c0b4ef8bb6d6bb9bd380a11
39 a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11
40 {a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}
41 </pre><p>
42     Output is always in the standard form.
43    </p><p>
44     See <a class="xref" href="functions-uuid.html" title="9.14. UUID Functions">Section 9.14</a> for how to generate a UUID in
45     <span class="productname">PostgreSQL</span>.
46    </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="datatype-textsearch.html" title="8.11. Text Search Types">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="datatype.html" title="Chapter 8. Data Types">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="datatype-xml.html" title="8.13. XML Type">Next</a></td></tr><tr><td width="40%" align="left" valign="top">8.11. Text Search Types </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 8.13. <acronym class="acronym">XML</acronym> Type</td></tr></table></div></body></html>