|
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <!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>F.44. uuid-ossp</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 V1.79.1" /><link rel="prev" href="unaccent.html" title="F.43. unaccent" /><link rel="next" href="xml2.html" title="F.45. xml2" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.44. uuid-ossp</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="unaccent.html" title="F.43. unaccent">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="xml2.html" title="F.45. xml2">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="UUID-OSSP"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.44. uuid-ossp</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="uuid-ossp.html#id-1.11.7.53.4">F.44.1. <code class="literal">uuid-ossp</code> Functions</a></span></dt><dt><span class="sect2"><a href="uuid-ossp.html#id-1.11.7.53.5">F.44.2. Building <code class="filename">uuid-ossp</code></a></span></dt><dt><span class="sect2"><a href="uuid-ossp.html#id-1.11.7.53.6">F.44.3. Author</a></span></dt></dl></div><a id="id-1.11.7.53.2" class="indexterm"></a><p>
- The <code class="filename">uuid-ossp</code> module provides functions to generate universally
- unique identifiers (UUIDs) using one of several standard algorithms. There
- are also functions to produce certain special UUID constants.
- </p><div class="sect2" id="id-1.11.7.53.4"><div class="titlepage"><div><div><h3 class="title">F.44.1. <code class="literal">uuid-ossp</code> Functions</h3></div></div></div><p>
- <a class="xref" href="uuid-ossp.html#UUID-OSSP-FUNCTIONS" title="Table F.32. Functions for UUID Generation">Table F.32</a> shows the functions available to
- generate UUIDs.
- The relevant standards ITU-T Rec. X.667, ISO/IEC 9834-8:2005, and RFC
- 4122 specify four algorithms for generating UUIDs, identified by the
- version numbers 1, 3, 4, and 5. (There is no version 2 algorithm.)
- Each of these algorithms could be suitable for a different set of
- applications.
- </p><div class="table" id="UUID-OSSP-FUNCTIONS"><p class="title"><strong>Table F.32. Functions for UUID Generation</strong></p><div class="table-contents"><table class="table" summary="Functions for UUID Generation" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Function</th><th>Description</th></tr></thead><tbody><tr><td><code class="function">uuid_generate_v1()</code><a id="id-1.11.7.53.4.3.2.2.1.1.2" class="indexterm"></a></td><td>
- <p>
- This function generates a version 1 UUID. This involves the MAC
- address of the computer and a time stamp. Note that UUIDs of this
- kind reveal the identity of the computer that created the identifier
- and the time at which it did so, which might make it unsuitable for
- certain security-sensitive applications.
- </p>
- </td></tr><tr><td><code class="function">uuid_generate_v1mc()</code><a id="id-1.11.7.53.4.3.2.2.2.1.2" class="indexterm"></a></td><td>
- <p>
- This function generates a version 1 UUID but uses a random multicast
- MAC address instead of the real MAC address of the computer.
- </p>
- </td></tr><tr><td><code class="function">uuid_generate_v3(namespace uuid, name text)</code><a id="id-1.11.7.53.4.3.2.2.3.1.2" class="indexterm"></a></td><td>
- <p>
- This function generates a version 3 UUID in the given namespace using
- the specified input name. The namespace should be one of the special
- constants produced by the <code class="function">uuid_ns_*()</code> functions shown
- in <a class="xref" href="uuid-ossp.html#UUID-OSSP-CONSTANTS" title="Table F.33. Functions Returning UUID Constants">Table F.33</a>. (It could be any UUID in theory.) The name is an identifier
- in the selected namespace.
- </p>
-
- <p>
- For example:
-
- </p><pre class="programlisting">
- SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
- </pre><p>
-
- The name parameter will be MD5-hashed, so the cleartext cannot be
- derived from the generated UUID.
- The generation of UUIDs by this method has no random or
- environment-dependent element and is therefore reproducible.
- </p>
- </td></tr><tr><td><code class="literal">uuid_generate_v4()</code></td><td>
- <p>
- This function generates a version 4 UUID, which is derived entirely
- from random numbers.
- </p>
- </td></tr><tr><td><code class="literal">uuid_generate_v5(namespace uuid, name text)</code></td><td>
- <p>
- This function generates a version 5 UUID, which works like a version 3
- UUID except that SHA-1 is used as a hashing method. Version 5 should
- be preferred over version 3 because SHA-1 is thought to be more secure
- than MD5.
- </p>
- </td></tr></tbody></table></div></div><br class="table-break" /><div class="table" id="UUID-OSSP-CONSTANTS"><p class="title"><strong>Table F.33. Functions Returning UUID Constants</strong></p><div class="table-contents"><table class="table" summary="Functions Returning UUID Constants" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td><code class="literal">uuid_nil()</code></td><td>
- <p>
- A <span class="quote">“<span class="quote">nil</span>”</span> UUID constant, which does not occur as a real UUID.
- </p>
- </td></tr><tr><td><code class="literal">uuid_ns_dns()</code></td><td>
- <p>
- Constant designating the DNS namespace for UUIDs.
- </p>
- </td></tr><tr><td><code class="literal">uuid_ns_url()</code></td><td>
- <p>
- Constant designating the URL namespace for UUIDs.
- </p>
- </td></tr><tr><td><code class="literal">uuid_ns_oid()</code></td><td>
- <p>
- Constant designating the ISO object identifier (OID) namespace for
- UUIDs. (This pertains to ASN.1 OIDs, which are unrelated to the OIDs
- used in <span class="productname">PostgreSQL</span>.)
- </p>
- </td></tr><tr><td><code class="literal">uuid_ns_x500()</code></td><td>
- <p>
- Constant designating the X.500 distinguished name (DN) namespace for
- UUIDs.
- </p>
- </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="id-1.11.7.53.5"><div class="titlepage"><div><div><h3 class="title">F.44.2. Building <code class="filename">uuid-ossp</code></h3></div></div></div><p>
- Historically this module depended on the OSSP UUID library, which accounts
- for the module's name. While the OSSP UUID library can still be found
- at <a class="ulink" href="http://www.ossp.org/pkg/lib/uuid/" target="_top">http://www.ossp.org/pkg/lib/uuid/</a>, it is not well
- maintained, and is becoming increasingly difficult to port to newer
- platforms. <code class="filename">uuid-ossp</code> can now be built without the OSSP
- library on some platforms. On FreeBSD, NetBSD, and some other BSD-derived
- platforms, suitable UUID creation functions are included in the
- core <code class="filename">libc</code> library. On Linux, macOS, and some other
- platforms, suitable functions are provided in the <code class="filename">libuuid</code>
- library, which originally came from the <code class="literal">e2fsprogs</code> project
- (though on modern Linux it is considered part
- of <code class="literal">util-linux-ng</code>). When invoking <code class="filename">configure</code>,
- specify <code class="option">--with-uuid=bsd</code> to use the BSD functions,
- or <code class="option">--with-uuid=e2fs</code> to
- use <code class="literal">e2fsprogs</code>' <code class="filename">libuuid</code>, or
- <code class="option">--with-uuid=ossp</code> to use the OSSP UUID library.
- More than one of these libraries might be available on a particular
- machine, so <code class="filename">configure</code> does not automatically choose one.
- </p><div class="note"><h3 class="title">Note</h3><p>
- If you only need randomly-generated (version 4) UUIDs,
- consider using the <code class="function">gen_random_uuid()</code> function
- from the <a class="xref" href="pgcrypto.html" title="F.25. pgcrypto">pgcrypto</a> module instead.
- </p></div></div><div class="sect2" id="id-1.11.7.53.6"><div class="titlepage"><div><div><h3 class="title">F.44.3. Author</h3></div></div></div><p>
- Peter Eisentraut <code class="email"><<a class="email" href="mailto:peter_e@gmx.net">peter_e@gmx.net</a>></code>
- </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="unaccent.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="xml2.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.43. unaccent </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> F.45. xml2</td></tr></table></div></body></html>
|