diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 3c52d90d3ab..5b225ccf4f5 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -14127,6 +14127,14 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple <primary>gen_random_uuid</primary> </indexterm> + <indexterm> + <primary>uuid_extract_timestamp</primary> + </indexterm> + + <indexterm> + <primary>uuid_extract_version</primary> + </indexterm> + <para> <productname>PostgreSQL</productname> includes one function to generate a UUID: <synopsis> @@ -14142,6 +14150,28 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple </para> <para> + There are also functions to extract data from UUIDs: +<synopsis> +<function>uuid_extract_timestamp</function> (uuid) <returnvalue>timestamp with time zone</returnvalue> +</synopsis> + This function extracts a <type>timestamp with time zone</type> from UUID + version 1. For other versions, this function returns null. Note that the + extracted timestamp is not necessarily exactly equal to the time the UUID + was generated; this depends on the implementation that generated the UUID. + </para> + + <para> +<synopsis> +<function>uuid_extract_version</function> (uuid) <returnvalue>smallint</returnvalue> +</synopsis> + This function extracts the version from a UUID of the variant described by + <ulink url="https://tools.ietf.org/html/rfc4122">RFC 4122</ulink>. For + other variants, this function returns null. For example, for a UUID + generated by <function>gen_random_uuid</function>, this function will + return 4. + </para> + + <para> <productname>PostgreSQL</productname> also provides the usual comparison operators shown in <xref linkend="functions-comparison-op-table"/> for UUIDs. |