pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
8+ messages / 5 participants
[nested] [flat]
Commits from this thread:
2022-09-01 fbd597e0b8 4e3eb6dd1a 8dc12a9b64 9d8f19201a doc: clarify that pgcrypto's gen_random_uuid calls core func.
* BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
@ 2021-12-28 16:31 PG Bug reporting form <noreply@postgresql.org>
2021-12-28 17:41 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 8+ messages in thread
From: PG Bug reporting form @ 2021-12-28 16:31 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: andreas.dijkman@cygnis.nl
The following bug has been logged on the website:
Bug reference: 17349
Logged by: Andreas Dijkman
Email address: andreas.dijkman@cygnis.nl
PostgreSQL version: 14.1
Operating system: Oracle Linux 8
Description:
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?
I'm installing this extension in a PostgreSQL 14.1 database on Oracle Linux
8 (I think this is valid for every OS with every version of PostgreSQL 13
and up).
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:
postgres=# create database testdb;
CREATE DATABASE
postgres=# \c testdb
You are now connected to database "testdb" as user "postgres".
testdb=# create extension pgcrypto schema pg_catalog;
ERROR: function "gen_random_uuid" already exists with same argument types
If you install the pgcrypto-extension in the public-schema, the function
gen_random_uuid probably never gets used because the same function in
pg_catalog (probably) has precedence by default.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
2021-12-28 16:31 BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core PG Bug reporting form <noreply@postgresql.org>
@ 2021-12-28 17:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-12-28 20:36 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Andreas Dijkman <andreas.dijkman@cygnis.nl>
0 siblings, 1 reply; 8+ messages in thread
From: Tom Lane @ 2021-12-28 17:41 UTC (permalink / raw)
To: andreas.dijkman@cygnis.nl; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.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#7f...
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
2021-12-28 16:31 BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core PG Bug reporting form <noreply@postgresql.org>
2021-12-28 17:41 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-12-28 20:36 ` Andreas Dijkman <andreas.dijkman@cygnis.nl>
2022-08-16 18:14 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Dijkman @ 2021-12-28 20:36 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
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@sss.pgh.pa.us<mailto:tgl@sss.pgh.pa.us>> wrote:
PG Bug reporting form <noreply@postgresql.org<mailto:noreply@postgresql.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#7f...
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
2021-12-28 16:31 BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core PG Bug reporting form <noreply@postgresql.org>
2021-12-28 17:41 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Tom Lane <tgl@sss.pgh.pa.us>
2021-12-28 20:36 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Andreas Dijkman <andreas.dijkman@cygnis.nl>
@ 2022-08-16 18:14 ` Bruce Momjian <bruce@momjian.us>
2022-08-16 21:40 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Daniel Gustafsson <daniel@yesql.se>
0 siblings, 1 reply; 8+ messages in thread
From: Bruce Momjian @ 2022-08-16 18:14 UTC (permalink / raw)
To: Andreas Dijkman <andreas.dijkman@cygnis.nl>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
On Tue, Dec 28, 2021 at 08:36:22PM +0000, Andreas Dijkman wrote:
> 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.
I have written the attached patch to clarify this.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Indecision is a decision. Inaction is an action. Mark Batterson
Attachments:
pgcrypto.diff (text/x-diff, 576B) download
diff --git a/doc/src/sgml/pgcrypto.sgml b/doc/src/sgml/pgcrypto.sgml
index 79759654a7..08172b7f84 100644
--- a/doc/src/sgml/pgcrypto.sgml
+++ b/doc/src/sgml/pgcrypto.sgml
@@ -1143,8 +1143,8 @@ gen_random_bytes(count integer) returns bytea
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>.)
+ Returns a version 4 (random) UUID. (Obsolete, this function
+ internally calls the core function of the same name.)
</para>
</sect2>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
2021-12-28 16:31 BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core PG Bug reporting form <noreply@postgresql.org>
2021-12-28 17:41 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Tom Lane <tgl@sss.pgh.pa.us>
2021-12-28 20:36 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Andreas Dijkman <andreas.dijkman@cygnis.nl>
2022-08-16 18:14 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
@ 2022-08-16 21:40 ` Daniel Gustafsson <daniel@yesql.se>
2022-08-16 21:58 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Gustafsson @ 2022-08-16 21:40 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Andreas Dijkman <andreas.dijkman@cygnis.nl>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
> On 16 Aug 2022, at 20:14, Bruce Momjian <bruce@momjian.us> wrote:
> On Tue, Dec 28, 2021 at 08:36:22PM +0000, Andreas Dijkman wrote:
>> That would have avoided this bug-report I guess, as the documentation would
>> reflect the actual situation better.
>
> I have written the attached patch to clarify this.
LGTM. I would've added an <xref linkend="functions-uuid"/> to the the "core
function" part but that's about it.
--
Daniel Gustafsson https://vmware.com/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
2021-12-28 16:31 BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core PG Bug reporting form <noreply@postgresql.org>
2021-12-28 17:41 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Tom Lane <tgl@sss.pgh.pa.us>
2021-12-28 20:36 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Andreas Dijkman <andreas.dijkman@cygnis.nl>
2022-08-16 18:14 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
2022-08-16 21:40 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Daniel Gustafsson <daniel@yesql.se>
@ 2022-08-16 21:58 ` Bruce Momjian <bruce@momjian.us>
2022-08-16 22:18 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Daniel Gustafsson <daniel@yesql.se>
0 siblings, 1 reply; 8+ messages in thread
From: Bruce Momjian @ 2022-08-16 21:58 UTC (permalink / raw)
To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Andreas Dijkman <andreas.dijkman@cygnis.nl>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
On Tue, Aug 16, 2022 at 11:40:15PM +0200, Daniel Gustafsson wrote:
> > On 16 Aug 2022, at 20:14, Bruce Momjian <bruce@momjian.us> wrote:
> > On Tue, Dec 28, 2021 at 08:36:22PM +0000, Andreas Dijkman wrote:
>
> >> That would have avoided this bug-report I guess, as the documentation would
> >> reflect the actual situation better.
> >
> > I have written the attached patch to clarify this.
>
> LGTM. I would've added an <xref linkend="functions-uuid"/> to the the "core
> function" part but that's about it.
Sure, attached. I used <link> so I could just mark the text, rather
than adding the chapter number.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Indecision is a decision. Inaction is an action. Mark Batterson
Attachments:
pgcrypto.diff (text/x-diff, 619B) download
diff --git a/doc/src/sgml/pgcrypto.sgml b/doc/src/sgml/pgcrypto.sgml
index 79759654a7..043342e798 100644
--- a/doc/src/sgml/pgcrypto.sgml
+++ b/doc/src/sgml/pgcrypto.sgml
@@ -1143,8 +1143,9 @@ gen_random_bytes(count integer) returns bytea
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>.)
+ Returns a version 4 (random) UUID. (Obsolete, this function
+ internally calls the <link linkend="functions-uuid"/>core
+ function</link> of the same name.)
</para>
</sect2>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
2021-12-28 16:31 BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core PG Bug reporting form <noreply@postgresql.org>
2021-12-28 17:41 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Tom Lane <tgl@sss.pgh.pa.us>
2021-12-28 20:36 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Andreas Dijkman <andreas.dijkman@cygnis.nl>
2022-08-16 18:14 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
2022-08-16 21:40 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Daniel Gustafsson <daniel@yesql.se>
2022-08-16 21:58 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
@ 2022-08-16 22:18 ` Daniel Gustafsson <daniel@yesql.se>
2022-09-01 02:05 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Gustafsson @ 2022-08-16 22:18 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Andreas Dijkman <andreas.dijkman@cygnis.nl>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs@lists.postgresql.org
> On 16 Aug 2022, at 23:58, Bruce Momjian <bruce@momjian.us> wrote:
>
> On Tue, Aug 16, 2022 at 11:40:15PM +0200, Daniel Gustafsson wrote:
>>>> On 16 Aug 2022, at 20:14, Bruce Momjian <bruce@momjian.us> wrote:
>>> On Tue, Dec 28, 2021 at 08:36:22PM +0000, Andreas Dijkman wrote:
>>
>>>> That would have avoided this bug-report I guess, as the documentation would
>>>> reflect the actual situation better.
>>>
>>> I have written the attached patch to clarify this.
>>
>> LGTM. I would've added an <xref linkend="functions-uuid"/> to the the "core
>> function" part but that's about it.
>
> Sure, attached. I used <link> so I could just mark the text, rather
> than adding the chapter number.
Of course, that makes sense. +1 for this version.
cheers ./daniel
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core
2021-12-28 16:31 BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core PG Bug reporting form <noreply@postgresql.org>
2021-12-28 17:41 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Tom Lane <tgl@sss.pgh.pa.us>
2021-12-28 20:36 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Andreas Dijkman <andreas.dijkman@cygnis.nl>
2022-08-16 18:14 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
2022-08-16 21:40 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Daniel Gustafsson <daniel@yesql.se>
2022-08-16 21:58 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Bruce Momjian <bruce@momjian.us>
2022-08-16 22:18 ` Re: BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core Daniel Gustafsson <daniel@yesql.se>
@ 2022-09-01 02:05 ` Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 8+ messages in thread
From: Bruce Momjian @ 2022-09-01 02:05 UTC (permalink / raw)
To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Andreas Dijkman <andreas.dijkman@cygnis.nl>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs@lists.postgresql.org
On Wed, Aug 17, 2022 at 12:18:06AM +0200, Daniel Gustafsson wrote:
> > On 16 Aug 2022, at 23:58, Bruce Momjian <bruce@momjian.us> wrote:
> >
> > On Tue, Aug 16, 2022 at 11:40:15PM +0200, Daniel Gustafsson wrote:
> >>>> On 16 Aug 2022, at 20:14, Bruce Momjian <bruce@momjian.us> wrote:
> >>> On Tue, Dec 28, 2021 at 08:36:22PM +0000, Andreas Dijkman wrote:
> >>
> >>>> That would have avoided this bug-report I guess, as the documentation would
> >>>> reflect the actual situation better.
> >>>
> >>> I have written the attached patch to clarify this.
> >>
> >> LGTM. I would've added an <xref linkend="functions-uuid"/> to the the "core
> >> function" part but that's about it.
> >
> > Sure, attached. I used <link> so I could just mark the text, rather
> > than adding the chapter number.
>
> Of course, that makes sense. +1 for this version.
Patch applied back to PG 13, where this was applicable. Thanks for the
team work on this one.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Indecision is a decision. Inaction is an action. Mark Batterson
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2022-09-01 02:05 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 16:31 BUG #17349: Function gen_random_uuid duplicates in pgcrypto and core PG Bug reporting form <noreply@postgresql.org>
2021-12-28 17:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-12-28 20:36 ` Andreas Dijkman <andreas.dijkman@cygnis.nl>
2022-08-16 18:14 ` Bruce Momjian <bruce@momjian.us>
2022-08-16 21:40 ` Daniel Gustafsson <daniel@yesql.se>
2022-08-16 21:58 ` Bruce Momjian <bruce@momjian.us>
2022-08-16 22:18 ` Daniel Gustafsson <daniel@yesql.se>
2022-09-01 02:05 ` Bruce Momjian <bruce@momjian.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox