Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core

From: Andreas Dijkman <andreas(dot)dijkman(at)cygnis(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
Date: 2021-12-28 20:36:22
Message-ID: 046A362C-31BC-4C40-ACE5-B71B65EA541A@cygnis.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks for pointing me to the discussion. I’ve read the thread and would suggest applying the doc-note, that’s in the last part of that discussion:

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.

That would have avoided this bug-report I guess, as the documentation would reflect the actual situation better.

Regards,
Andreas Dijkman

On 28 Dec 2021, at 18:41, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us<mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:

PG Bug reporting form <noreply(at)postgresql(dot)org<mailto:noreply(at)postgresql(dot)org>> writes:
As stated in
https://www.postgresql.org/docs/current/pgcrypto.html#id-1.11.7.35.10, the
function gen_random_uuid is now part of core PostgreSQL. Shouldn't this
function be removed from the pgcrypto-extension as of PostgreSQL 13?

pg_crypto's gen_random_uuid() is now just a wrapper for the core function.
Taking it out entirely would save only a couple lines of code.

If you install the pgcrypto-extension in the pg_catalog-schema (yes, I'm
aware if installing it in public the error doesn't occur) you get an
error:

The contrary side of that is that taking it out of the extension could
break applications that expect gen_random_uuid() to exist in the
extension's schema. I don't think we consider installing extensions
in pg_catalog to be a supported case, anyway.

See previous discussion at

https://www.postgresql.org/message-id/flat/5b2c6230-e0b9-59a9-b945-c7d38fdae296%402ndquadrant.com#7ff316009e81aad797b6c0136251118c

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2021-12-29 10:20:06 Re: BUG #17347: pg_upgrade: analyze_new_cluster script analyzes wrong cluster
Previous Message Mathias Kunter 2021-12-28 18:12:06 Re: BUG #17347: pg_upgrade: analyze_new_cluster script analyzes wrong cluster