Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/uuid-ossp.sgml`
9b7736c39ad65746de5d7f6b8a535731e25b514e4942f5280000000100000af6
 <function>uuid_generate_v3</function> ( <parameter>namespace</parameter> <type>uuid</type>, <parameter>name</parameter> <type>text</type> )
        <returnvalue>uuid</returnvalue>
       </para>
       <para>
        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 <function>uuid_ns_*()</function> functions
        shown in <xref linkend="uuid-ossp-constants"/>.  (It could be any UUID
        in theory.)  The name is an identifier in the selected namespace.
       </para>
       <para>
        For example:

<programlisting>
SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
</programlisting>

        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.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>uuid_generate_v4</function> ()
        <returnvalue>uuid</returnvalue>
       </para>
       <para>
        Generates a version 4 UUID, which is derived entirely
        from random numbers.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>uuid_generate_v5</function> ( <parameter>namespace</parameter> <type>uuid</type>, <parameter>name</parameter> <type>text</type> )
        <returnvalue>uuid</returnvalue>
       </para>
       <para>
        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.
       </para></entry>
      </row>
     </tbody>
    </tgroup>
  </table>

  <table id="uuid-ossp-constants">
   <title>Functions Returning UUID Constants</title>
    <tgroup cols="1">
     <thead>
      <row>
       <entry role="func_table_entry"><para role="func_signature">
        Function
       </para>
       <para>
        Description
       </para></entry>
      </row>
     </thead>

     <tbody>
      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>uuid_nil</function> ()
        <returnvalue>uuid</returnvalue>
       </para>
       <para>
        Returns a <quote>nil</quote> UUID constant, which does not occur as a
        real UUID.
       </para></entry>
      </row>

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <function>uuid_ns_dns</function> ()
        <returnvalue>uuid</returnvalue>
       </para>
       <para>

Title: UUID Generation Functions and Constants in uuid-ossp Module
Summary
This section details the UUID generation functions available in the `uuid-ossp` module, including `uuid_generate_v3` (MD5 hashing), `uuid_generate_v4` (random number based), and `uuid_generate_v5` (SHA-1 hashing). It also lists functions returning UUID constants like `uuid_nil` and `uuid_ns_dns`.