pgsql: Reject bogus output from uuid_create(3).

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reject bogus output from uuid_create(3).
Date: 2022-09-09 16:41:56
Message-ID: E1oWh4m-002AiU-6z@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Reject bogus output from uuid_create(3).

When using the BSD UUID functions, contrib/uuid-ossp expects
uuid_create() to produce a version-1 UUID. FreeBSD still does so,
but in recent NetBSD releases that function produces a version-4
(random) UUID instead. That's not acceptable for our purposes:
if the user wanted v4 she would have asked for v4, not v1.
Hence, check the version digit and complain if it's not '1'.

Also drop the documentation's claim that the NetBSD implementation
is usable. It might be, depending on which OS version you're using,
but we're not going to get into that kind of detail.

(Maybe someday we should ditch all these external libraries
and just write our own UUID code, but today is not that day.)

Nazir Bilal Yavuz, with cosmetic adjustments and docs by me.
Backpatch to all supported versions.

Discussion: https://postgr.es/m/3848059.1661038772@sss.pgh.pa.us
Discussion: https://postgr.es/m/17358-89806e7420797025@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/23fe89a612238e269b621245fe9e4c882b9ef07b

Modified Files
--------------
contrib/uuid-ossp/uuid-ossp.c | 12 ++++++++++++
doc/src/sgml/installation.sgml | 2 +-
doc/src/sgml/uuid-ossp.sgml | 2 +-
3 files changed, 14 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-09-09 17:50:52 pgsql: Doc: improve documentation about where the psqlrc files are.
Previous Message Alvaro Herrera 2022-09-09 11:52:44 pgsql: Doc fixes for MERGE statement