Re: [HACKERS] Patch for UUID datatype (beta) - Mailing list pgsql-patches

From Jim C. Nasby
Subject Re: [HACKERS] Patch for UUID datatype (beta)
Date
Msg-id 20060919132013.GT47167@enterprisedb.com
Whole thread Raw
In response to Re: [HACKERS] Patch for UUID datatype (beta)  (mark@mark.mielke.cc)
Responses Re: [HACKERS] Patch for UUID datatype (beta)
List pgsql-patches
On Mon, Sep 18, 2006 at 07:45:07PM -0400, mark@mark.mielke.cc wrote:
> I would not use a 100% random number generator for a UUID value as was
> suggested. I prefer inserting the MAC address and the time, to at
> least allow me to control if a collision is possible. This is not easy
> to do using a few lines of C code. I'd rather have a UUID type in core
> with no generation routine, than no UUID type in core because the code
> is too complicated to maintain, or not portable enough.

As others have mentioned, using MAC address doesn't remove the
possibility of a collision.

Maybe a good compromise that would allow a generator function to go into
the backend would be to combine the current time with a random number.
That will ensure that you won't get a dupe, so long as your clock never
runs backwards.
--
Jim Nasby                                    jimn@enterprisedb.com
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

pgsql-patches by date:

Previous
From: Gevik Babakhani
Date:
Subject: new patch for uuid datatype
Next
From: "Albe Laurenz"
Date:
Subject: Re: Dynamic linking on AIX