1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-18 04:29:09 +03:00

Doc: clean up documentation for new UUID functions.

Fix assorted failures to conform to our normal style for function
documentation, such as lack of parentheses and incorrect markup.

Author: Marcos Pegoraro <marcos@f10.com.br>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAB-JLwbocrFjKfGHoKY43pHTf49Ca2O0j3WVebC8z-eQBMPJyw@mail.gmail.com
Backpatch-through: 18
This commit is contained in:
Tom Lane
2025-09-25 11:23:27 -04:00
parent 170a8a3f46
commit 507aa16125

View File

@@ -36,8 +36,7 @@
<tgroup cols="1"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry role="func_table_entry"> <entry role="func_table_entry"><para role="func_signature">
<para role="func_signature">
Function Function
</para> </para>
<para> <para>
@@ -45,24 +44,22 @@
</para> </para>
<para> <para>
Example(s) Example(s)
</para> </para></entry>
</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry role="func_table_entry"> <entry role="func_table_entry"><para role="func_signature">
<para role="func_signature"> <function>gen_random_uuid</function> ( )
<type>gen_random_uuid</type>
<returnvalue>uuid</returnvalue> <returnvalue>uuid</returnvalue>
</para> </para>
<para role="func_signature"> <para role="func_signature">
<type>uuidv4</type> <function>uuidv4</function> ( )
<returnvalue>uuid</returnvalue> <returnvalue>uuid</returnvalue>
</para> </para>
<para> <para>
Generate a version 4 (random) UUID. Generates a version 4 (random) UUID
</para> </para>
<para> <para>
<literal>gen_random_uuid()</literal> <literal>gen_random_uuid()</literal>
@@ -71,26 +68,25 @@
<para> <para>
<literal>uuidv4()</literal> <literal>uuidv4()</literal>
<returnvalue>b42410ee-132f-42ee-9e4f-09a6485c95b8</returnvalue> <returnvalue>b42410ee-132f-42ee-9e4f-09a6485c95b8</returnvalue>
</para> </para></entry>
</entry>
</row> </row>
<row> <row>
<entry role="func_table_entry"> <entry role="func_table_entry"><para role="func_signature">
<para role="func_signature"> <function>uuidv7</function>
<type>uuidv7</type>
( <optional> <parameter>shift</parameter> <type>interval</type> </optional> ) ( <optional> <parameter>shift</parameter> <type>interval</type> </optional> )
<returnvalue>uuid</returnvalue> <returnvalue>uuid</returnvalue>
</para> </para>
<para> <para>
Generate a version 7 (time-ordered) UUID. The timestamp is computed using UNIX timestamp Generates a version 7 (time-ordered) UUID. The timestamp is
with millisecond precision + sub-millisecond timestamp + random. The optional parameter computed using UNIX timestamp with millisecond precision +
<parameter>shift</parameter> will shift the computed timestamp by the given <type>interval</type>. sub-millisecond timestamp + random. The optional
parameter <parameter>shift</parameter> will shift the computed
timestamp by the given <type>interval</type>.
</para> </para>
<para> <para>
<literal>uuidv7()</literal> <literal>uuidv7()</literal>
<returnvalue>019535d9-3df7-79fb-b466-fa907fa17f9e</returnvalue> <returnvalue>019535d9-3df7-79fb-b466-fa907fa17f9e</returnvalue>
</para> </para></entry>
</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
@@ -113,8 +109,7 @@
<tgroup cols="1"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry role="func_table_entry"> <entry role="func_table_entry"><para role="func_signature">
<para role="func_signature">
Function Function
</para> </para>
<para> <para>
@@ -122,44 +117,41 @@
</para> </para>
<para> <para>
Example(s) Example(s)
</para> </para></entry>
</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry role="func_table_entry"> <entry role="func_table_entry"><para role="func_signature">
<para role="func_signature"> <function>uuid_extract_timestamp</function>
<type>uuid_extract_timestamp</type>
( <type>uuid</type> ) ( <type>uuid</type> )
<returnvalue>timestamp with time zone</returnvalue> <returnvalue>timestamp with time zone</returnvalue>
</para> </para>
<para> <para>
Extracts a <type>timestamp with time zone</type> from UUID Extracts a <type>timestamp with time zone</type> from a UUID of
version 1 and 7. For other versions, this function returns null. Note that version 1 or 7. For other versions, this function returns null.
the extracted timestamp is not necessarily exactly equal to the time the Note that the extracted timestamp is not necessarily exactly equal
UUID was generated; this depends on the implementation that generated the to the time the UUID was generated; this depends on the
UUID. implementation that generated the UUID.
</para> </para>
<para> <para>
<literal>uuid_extract_timestamp('019535d9-3df7-79fb-b466-&zwsp;fa907fa17f9e'::uuid)</literal> <literal>uuid_extract_timestamp('019535d9-3df7-79fb-b466-&zwsp;fa907fa17f9e'::uuid)</literal>
<returnvalue>2025-02-23 21:46:24.503-05</returnvalue> <returnvalue>2025-02-23 21:46:24.503-05</returnvalue>
</para> </para></entry>
</entry>
</row> </row>
<row> <row>
<entry role="func_table_entry"> <entry role="func_table_entry"><para role="func_signature">
<para role="func_signature"> <function>uuid_extract_version</function>
<type>uuid_extract_version</type>
( <type>uuid</type> ) ( <type>uuid</type> )
<returnvalue>smallint</returnvalue> <returnvalue>smallint</returnvalue>
</para> </para>
<para> <para>
Extracts the version from a UUID of the variant described by Extracts the version from a UUID of one of the variants described by
<ulink url="https://datatracker.ietf.org/doc/html/rfc9562">RFC 9562</ulink>. For <ulink url="https://datatracker.ietf.org/doc/html/rfc9562">RFC
other variants, this function returns null. For example, for a UUID 9562</ulink>. For other variants, this function returns null.
generated by <function>gen_random_uuid</function>, this function will For example, for a UUID generated
by <function>gen_random_uuid()</function>, this function will
return 4. return 4.
</para> </para>
<para> <para>
@@ -169,8 +161,7 @@
<para> <para>
<literal>uuid_extract_version('019535d9-3df7-79fb-b466-&zwsp;fa907fa17f9e'::uuid)</literal> <literal>uuid_extract_version('019535d9-3df7-79fb-b466-&zwsp;fa907fa17f9e'::uuid)</literal>
<returnvalue>7</returnvalue> <returnvalue>7</returnvalue>
</para> </para></entry>
</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>