Re: [PATCH] Implement uuid_version()

From: Ian Barwick <ian(dot)barwick(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Jose Luis Tallon <jltallon(at)adv-solutions(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>
Subject: Re: [PATCH] Implement uuid_version()
Date: 2019-07-15 02:37:35
Message-ID: d3b99933-da2b-8ea4-20f4-996f91052534@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
doc-pgcrypto-gen_random_uuid.v1.patch text/x-patch 882 bytes

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-07-15 02:40:57 Re: Commitfest 2019-07, the first of five* for PostgreSQL 13
Previous Message Thomas Munro 2019-07-15 02:35:39 Re: Re: SQL/JSON: functions