On 7/14/19 9:40 PM, Peter Eisentraut wrote:
On 2019-07-13 17:13, Fabien COELHO wrote:
What about avoiding a redirection with something like:
Datum (* const pg_random_uuid)(PG_FUNCTION_ARGS) = gen_random_uuid;
That seems very confusing.
Dunno. Possibly. The user does not have to look at the implementation, and
probably such code would deserve a comment.
The point is to avoid one call so as to perform the same (otherwise the
pg_random_uuid would be slightly slower), and to ensure that it behaves
the same, as it would be the very same function by construction.
I've switched the patch to ready anyway.
committed
Small doc tweak suggestion - the pgcrypto docs [1] now say about
gen_random_uuid():
Returns a version 4 (random) UUID. (Obsolete, this function is now also
included in core PostgreSQL.)
which gives the impression the code contains two versions of this function, the
core
one and an obsolete one in pgcrypto. Per the commit message the situation is
actually:
The pgcrypto implementation now internally redirects to the built-in one.
Suggested wording improvement in the attached patch.
[1] https://www.postgresql.org/docs/devel/pgcrypto.html#id-1.11.7.34.9
Regards
Ian Barwick
--
Ian Barwick https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/doc/src/sgml/pgcrypto.sgml b/doc/src/sgml/pgcrypto.sgml
new file mode 100644
index 0acd11e..f636703
*** a/doc/src/sgml/pgcrypto.sgml
--- b/doc/src/sgml/pgcrypto.sgml
*************** gen_random_bytes(count integer) returns
*** 1132,1139 ****
gen_random_uuid() returns uuid
</synopsis>
<para>
! Returns a version 4 (random) UUID. (Obsolete, this function is now also
! included in core <productname>PostgreSQL</productname>.)
</para>
</sect2>
--- 1132,1141 ----
gen_random_uuid() returns uuid
</synopsis>
<para>
! Returns a version 4 (random) UUID. (This function now redirects internally
! to the core <productname>PostgreSQL</productname> function providing
! the same functionality and is included in the extension for backwards compatibility;
! see <xref linkend="functions-uuid"/> for details.)
</para>
</sect2>