gooderp18绿色标准版
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

108 lines
9.7KB

  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>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>
  3. The <code class="filename">uuid-ossp</code> module provides functions to generate universally
  4. unique identifiers (UUIDs) using one of several standard algorithms. There
  5. are also functions to produce certain special UUID constants.
  6. </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>
  7. <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
  8. generate UUIDs.
  9. The relevant standards ITU-T Rec. X.667, ISO/IEC 9834-8:2005, and RFC
  10. 4122 specify four algorithms for generating UUIDs, identified by the
  11. version numbers 1, 3, 4, and 5. (There is no version 2 algorithm.)
  12. Each of these algorithms could be suitable for a different set of
  13. applications.
  14. </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>
  15. <p>
  16. This function generates a version 1 UUID. This involves the MAC
  17. address of the computer and a time stamp. Note that UUIDs of this
  18. kind reveal the identity of the computer that created the identifier
  19. and the time at which it did so, which might make it unsuitable for
  20. certain security-sensitive applications.
  21. </p>
  22. </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>
  23. <p>
  24. This function generates a version 1 UUID but uses a random multicast
  25. MAC address instead of the real MAC address of the computer.
  26. </p>
  27. </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>
  28. <p>
  29. This function generates a version 3 UUID in the given namespace using
  30. the specified input name. The namespace should be one of the special
  31. constants produced by the <code class="function">uuid_ns_*()</code> functions shown
  32. 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
  33. in the selected namespace.
  34. </p>
  35. <p>
  36. For example:
  37. </p><pre class="programlisting">
  38. SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
  39. </pre><p>
  40. The name parameter will be MD5-hashed, so the cleartext cannot be
  41. derived from the generated UUID.
  42. The generation of UUIDs by this method has no random or
  43. environment-dependent element and is therefore reproducible.
  44. </p>
  45. </td></tr><tr><td><code class="literal">uuid_generate_v4()</code></td><td>
  46. <p>
  47. This function generates a version 4 UUID, which is derived entirely
  48. from random numbers.
  49. </p>
  50. </td></tr><tr><td><code class="literal">uuid_generate_v5(namespace uuid, name text)</code></td><td>
  51. <p>
  52. This function generates a version 5 UUID, which works like a version 3
  53. UUID except that SHA-1 is used as a hashing method. Version 5 should
  54. be preferred over version 3 because SHA-1 is thought to be more secure
  55. than MD5.
  56. </p>
  57. </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>
  58. <p>
  59. A <span class="quote">“<span class="quote">nil</span>”</span> UUID constant, which does not occur as a real UUID.
  60. </p>
  61. </td></tr><tr><td><code class="literal">uuid_ns_dns()</code></td><td>
  62. <p>
  63. Constant designating the DNS namespace for UUIDs.
  64. </p>
  65. </td></tr><tr><td><code class="literal">uuid_ns_url()</code></td><td>
  66. <p>
  67. Constant designating the URL namespace for UUIDs.
  68. </p>
  69. </td></tr><tr><td><code class="literal">uuid_ns_oid()</code></td><td>
  70. <p>
  71. Constant designating the ISO object identifier (OID) namespace for
  72. UUIDs. (This pertains to ASN.1 OIDs, which are unrelated to the OIDs
  73. used in <span class="productname">PostgreSQL</span>.)
  74. </p>
  75. </td></tr><tr><td><code class="literal">uuid_ns_x500()</code></td><td>
  76. <p>
  77. Constant designating the X.500 distinguished name (DN) namespace for
  78. UUIDs.
  79. </p>
  80. </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>
  81. Historically this module depended on the OSSP UUID library, which accounts
  82. for the module's name. While the OSSP UUID library can still be found
  83. 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
  84. maintained, and is becoming increasingly difficult to port to newer
  85. platforms. <code class="filename">uuid-ossp</code> can now be built without the OSSP
  86. library on some platforms. On FreeBSD, NetBSD, and some other BSD-derived
  87. platforms, suitable UUID creation functions are included in the
  88. core <code class="filename">libc</code> library. On Linux, macOS, and some other
  89. platforms, suitable functions are provided in the <code class="filename">libuuid</code>
  90. library, which originally came from the <code class="literal">e2fsprogs</code> project
  91. (though on modern Linux it is considered part
  92. of <code class="literal">util-linux-ng</code>). When invoking <code class="filename">configure</code>,
  93. specify <code class="option">--with-uuid=bsd</code> to use the BSD functions,
  94. or <code class="option">--with-uuid=e2fs</code> to
  95. use <code class="literal">e2fsprogs</code>' <code class="filename">libuuid</code>, or
  96. <code class="option">--with-uuid=ossp</code> to use the OSSP UUID library.
  97. More than one of these libraries might be available on a particular
  98. machine, so <code class="filename">configure</code> does not automatically choose one.
  99. </p><div class="note"><h3 class="title">Note</h3><p>
  100. If you only need randomly-generated (version 4) UUIDs,
  101. consider using the <code class="function">gen_random_uuid()</code> function
  102. from the <a class="xref" href="pgcrypto.html" title="F.25. pgcrypto">pgcrypto</a> module instead.
  103. </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>
  104. Peter Eisentraut <code class="email">&lt;<a class="email" href="mailto:peter_e@gmx.net">peter_e@gmx.net</a>&gt;</code>
  105. </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>
上海开阖软件有限公司 沪ICP备12045867号-1