<xref linkend="func_uuid_gen_table"/> shows the <productname>PostgreSQL</productname> functions that can be used to generate UUIDs. 表 9.45は、UUIDの生成に使用できるPostgreSQLの関数を示しています。
表9.45 UUID生成関数
Function 関数 Description 説明 Example(s) 例 |
|---|
Generates a version 4 (random) UUID バージョン4(ランダム)のUUIDを生成します。
|
Generates a version 7 (time-ordered) UUID. The timestamp is
computed using UNIX timestamp with millisecond precision +
sub-millisecond timestamp + random. The optional
parameter <parameter>shift</parameter> will shift the computed
timestamp by the given <type>interval</type>.
バージョン7(時間順)のUUIDを生成します。
タイムスタンプは、ミリ秒精度のUNIXタイムスタンプ+サブミリ秒のタイムスタンプ+ランダム値を使用して計算されます。
オプションのパラメータ
|
The <xref linkend="uuid-ossp"/> module provides additional functions that implement other standard algorithms for generating UUIDs. uuid-osspモジュールは、UUIDを生成するための他の標準アルゴリズムを実装した追加の関数を提供します。
<xref linkend="func_uuid_extract_table"/> shows the <productname>PostgreSQL</productname> functions that can be used to extract information from UUIDs. 表 9.46は、UUIDから情報を抽出するために使用できるPostgreSQL関数を示しています。
表9.46 UUID抽出関数
Function 関数 Description 説明 Example(s) 例 |
|---|
Extracts a <type>timestamp with time zone</type> from a UUID of
version 1 or 7. 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.
この関数は、UUIDのバージョン1または7から
|
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 other variants, this function returns null.
For example, for a UUID generated
by <function>gen_random_uuid()</function>, this function will
return 4.
この関数は、RFC 9562で説明されている種類のUUIDからバージョンを抽出します。
他の種類については、この関数はNULLを返します。
例えば、
|
<productname>PostgreSQL</productname> also provides the usual comparison operators shown in <xref linkend="functions-comparison-op-table"/> for UUIDs. PostgreSQLは表 9.1で示すUUIDのための通常の比較演算子を提供しています。
See <xref linkend="datatype-uuid"/> for details on the data type
<type>uuid</type> in <productname>PostgreSQL</productname>.
PostgreSQLのUUIDデータ型の詳細は8.12を参照してください。