The code to unlink dropped relations in FinishPreparedTransaction() was
[PostgreSQL.git] / doc / src / sgml / uuid-ossp.sgml
blobffaba4972628e4d92afe48c693e5322e941b698a
1 <!-- $PostgreSQL$ -->
3 <sect1 id="uuid-ossp">
4 <title>uuid-ossp</title>
6 <indexterm zone="uuid-ossp">
7 <primary>uuid-ossp</primary>
8 </indexterm>
10 <para>
11 The <filename>uuid-ossp</> module provides functions to generate universally
12 unique identifiers (UUIDs) using one of several standard algorithms. There
13 are also functions to produce certain special UUID constants.
14 </para>
16 <para>
17 This module depends on the OSSP UUID library, which can be found at
18 <ulink url="http://www.ossp.org/pkg/lib/uuid/"></ulink>.
19 </para>
21 <sect2>
22 <title><literal>uuid-ossp</literal> Functions</title>
24 <para>
25 The relevant standards ITU-T Rec. X.667, ISO/IEC 9834-8:2005, and RFC
26 4122 specify four algorithms for generating UUIDs, identified by the
27 version numbers 1, 3, 4, and 5. (There is no version 2 algorithm.)
28 Each of these algorithms could be suitable for a different set of
29 applications.
30 </para>
32 <table>
33 <title>Functions for UUID Generation</title>
34 <tgroup cols="2">
35 <thead>
36 <row>
37 <entry>Function</entry>
38 <entry>Description</entry>
39 </row>
40 </thead>
41 <tbody>
42 <row>
43 <entry><literal>uuid_generate_v1()</literal></entry>
44 <entry>
45 <para>
46 This function generates a version 1 UUID. This involves the MAC
47 address of the computer and a time stamp. Note that UUIDs of this
48 kind reveal the identity of the computer that created the identifier
49 and the time at which it did so, which might make it unsuitable for
50 certain security-sensitive applications.
51 </para>
52 </entry>
53 </row>
54 <row>
55 <entry><literal>uuid_generate_v1mc()</literal></entry>
56 <entry>
57 <para>
58 This function generates a version 1 UUID but uses a random multicast
59 MAC address instead of the real MAC address of the computer.
60 </para>
61 </entry>
62 </row>
63 <row>
64 <entry><literal>uuid_generate_v3(namespace uuid, name text)</literal></entry>
65 <entry>
66 <para>
67 This function generates a version 3 UUID in the given namespace using
68 the specified input name. The namespace should be one of the special
69 constants produced by the <function>uuid_ns_*()</> functions shown
70 below. (It could be any UUID in theory.) The name is an identifier
71 in the selected namespace.
72 </para>
73 </entry>
74 </row>
75 <row>
76 <entry><literal>uuid_generate_v4()</literal></entry>
77 <entry>
78 <para>
79 This function generates a version 4 UUID, which is derived entirely
80 from random numbers.
81 </para>
82 </entry>
83 </row>
84 <row>
85 <entry><literal>uuid_generate_v5(namespace uuid, name text)</literal></entry>
86 <entry>
87 <para>
88 This function generates a version 5 UUID, which works like a version 3
89 UUID except that SHA-1 is used as a hashing method. Version 5 should
90 be preferred over version 3 because SHA-1 is thought to be more secure
91 than MD5.
92 </para>
93 </entry>
94 </row>
95 </tbody>
96 </tgroup>
97 </table>
99 <para>
100 For example:
102 <programlisting>
103 SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
104 </programlisting>
106 The name parameter will be MD5-hashed, so the cleartext cannot be
107 derived from the generated UUID.
108 The generation of UUIDs by this method has no random or
109 environment-dependent element and is therefore reproducible.
110 </para>
112 <table>
113 <title>Functions Returning UUID Constants</title>
114 <tgroup cols="2">
115 <tbody>
116 <row>
117 <entry><literal>uuid_nil()</literal></entry>
118 <entry>
119 <para>
120 A <quote>nil</> UUID constant, which does not occur as a real UUID.
121 </para>
122 </entry>
123 </row>
124 <row>
125 <entry><literal>uuid_ns_dns()</literal></entry>
126 <entry>
127 <para>
128 Constant designating the DNS namespace for UUIDs.
129 </para>
130 </entry>
131 </row>
132 <row>
133 <entry><literal>uuid_ns_url()</literal></entry>
134 <entry>
135 <para>
136 Constant designating the URL namespace for UUIDs.
137 </para>
138 </entry>
139 </row>
140 <row>
141 <entry><literal>uuid_ns_oid()</literal></entry>
142 <entry>
143 <para>
144 Constant designating the ISO object identifier (OID) namespace for
145 UUIDs. (This pertains to ASN.1 OIDs, which are unrelated to the OIDs
146 used in <productname>PostgreSQL</>.)
147 </para>
148 </entry>
149 </row>
150 <row>
151 <entry><literal>uuid_ns_x500()</literal></entry>
152 <entry>
153 <para>
154 Constant designating the X.500 distinguished name (DN) namespace for
155 UUIDs.
156 </para>
157 </entry>
158 </row>
159 </tbody>
160 </tgroup>
161 </table>
162 </sect2>
164 <sect2>
165 <title>Author</title>
167 <para>
168 Peter Eisentraut <email>peter_e@gmx.net</email>
169 </para>
171 </sect2>
173 </sect1>