diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-01-17 16:52:06 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-01-17 16:52:06 -0500 |
| commit | e6170126fc201052b0ec5fc92177eb181d602d26 (patch) | |
| tree | 37c4660bd45764fa9737967f6e92a88bee19c5fb /doc/src | |
| parent | 708c529c7fdeba9387825d746752fc6f439d781e (diff) | |
Add gen_random_uuid() to contrib/pgcrypto.
This function provides a way of generating version 4 (pseudorandom) UUIDs
based on pgcrypto's PRNG. The main reason for doing this is that the
OSSP UUID library depended on by contrib/uuid-ossp is becoming more and
more of a porting headache, so we need an alternative for people who can't
install that. A nice side benefit though is that this implementation is
noticeably faster than uuid-ossp's uuid_generate_v4() function.
Oskari Saarenmaa, reviewed by Emre Hasegeli
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/datatype.sgml | 2 | ||||
| -rw-r--r-- | doc/src/sgml/pgcrypto.sgml | 11 | ||||
| -rw-r--r-- | doc/src/sgml/uuid-ossp.sgml | 9 |
3 files changed, 22 insertions, 0 deletions
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 03863300d4a..6bf4cf61d86 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -4015,6 +4015,8 @@ a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11 suited for every application. The <xref linkend="uuid-ossp"> module provides functions that implement several standard algorithms. + The <xref linkend="pgcrypto"> module also provides a generation + function for random UUIDs. Alternatively, UUIDs could be generated by client applications or other libraries invoked through a server-side function. </para> diff --git a/doc/src/sgml/pgcrypto.sgml b/doc/src/sgml/pgcrypto.sgml index b99a75c3668..31dba8cb731 100644 --- a/doc/src/sgml/pgcrypto.sgml +++ b/doc/src/sgml/pgcrypto.sgml @@ -1084,6 +1084,17 @@ gen_random_bytes(count integer) returns bytea At most 1024 bytes can be extracted at a time. This is to avoid draining the randomness generator pool. </para> + + <indexterm> + <primary>gen_random_uuid</primary> + </indexterm> + +<synopsis> +gen_random_uuid() returns uuid +</synopsis> + <para> + Returns a version 4 (random) UUID. + </para> </sect2> <sect2> diff --git a/doc/src/sgml/uuid-ossp.sgml b/doc/src/sgml/uuid-ossp.sgml index 696cc112dc8..c48106ba0f4 100644 --- a/doc/src/sgml/uuid-ossp.sgml +++ b/doc/src/sgml/uuid-ossp.sgml @@ -18,6 +18,15 @@ <ulink url="http://www.ossp.org/pkg/lib/uuid/"></ulink>. </para> + <note> + <para> + The OSSP UUID library is not well maintained, and is becoming increasingly + difficult to port to newer platforms. If you only need randomly-generated + (version 4) UUIDs, consider using the <function>gen_random_uuid()</> + function from the <xref linkend="pgcrypto"> module instead. + </para> + </note> + <sect2> <title><literal>uuid-ossp</literal> Functions</title> |
