Re: How can I build OSSP UUID support on Windows to avoid duplicate UUIDs?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: MauMau <maumau307(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Hiroshi Saito <hiroshi(at)winpg(dot)jp>, Dave Page <dpage(at)pgadmin(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How can I build OSSP UUID support on Windows to avoid duplicate UUIDs?
Date: 2013-10-31 12:22:14
Message-ID: CA+TgmoZhw=t69UbmARVMGuGrjJ8g3ZVjuUnYMmf_9P7sfzWYOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 30, 2013 at 5:32 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "MauMau" <maumau307(at)gmail(dot)com> writes:
>> From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>>> Yeah, but what shall we replace it with? And can we preserve the
>>> API contrib/uuid-ossp offers? (Maybe we shouldn't even try, but
>>> just deprecate that module and start fresh.)
>
>> Would it be welcomed in this community if a patch for built-in UUID
>> generation functions are provided?
>
> Based on what? The reason we've held this code at arms length (in a
> contrib module) is exactly that we weren't too satisfied with the
> portability or adequacy of the generation methods. Moving the functions
> into core doesn't do anything to make that better; rather, it raises the
> portability bar even higher, as well as making it almost impossible to
> contemplate further API changes.
>
> Note the lack of enthusiasm for taking on maintainership of the OSSP
> code. Pushing it into core would mean that we're buying into that
> maintainership, hook line and sinker. I don't think that such a
> proposal would fly.

ISTM that the biggest problem is that we don't have a random number
generator which generates enough bits of randomness to implement
uuid_generate_v3. I think relatively few people would cry if we
didn't support uuid_generate_v1(), and the others all look simple
enough, provided there's somewhere to get lots of random bits.

On Linux, it seems like we could get those bits from /dev/urandom,
though I'm not sure how efficient that would be for the case where
many UUIDs are being generated at once. But that wouldn't be very
portable. It's tempting to think that we'd need a PRNG that generates
wider values, for which we might find other application also. But I'm
not volunteering to be the one to create such a thing.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message MauMau 2013-10-31 12:40:07 [bug fix] PostgreSQL fails to start on Windows if it crashes after tablespace creation
Previous Message Robert Haas 2013-10-31 12:12:48 Re: PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"