Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Patch for UUID datatype (beta)

From: "Jim C(dot) Nasby" <jimn(at)enterprisedb(dot)com>
To: mark(at)mark(dot)mielke(dot)cc
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org,Andreas Pflug <pgadmin(at)pse-consulting(dot)de>,Gevik Babakhani <pgdev(at)xs4all(dot)nl>,pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Patch for UUID datatype (beta)
Date: 2006-09-19 13:20:13
Message-ID: 20060919132013.GT47167@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
On Mon, Sep 18, 2006 at 07:45:07PM -0400, mark(at)mark(dot)mielke(dot)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(at)enterprisedb(dot)com
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

In response to

Responses

pgsql-hackers by date

Next:From: Tomi NADate: 2006-09-19 13:30:15
Subject: Re: vista
Previous:From: Dave PageDate: 2006-09-19 13:19:39
Subject: Re: vista

pgsql-patches by date

Next:From: Albe LaurenzDate: 2006-09-19 13:30:26
Subject: Re: Dynamic linking on AIX
Previous:From: Gevik BabakhaniDate: 2006-09-19 12:28:27
Subject: new patch for uuid datatype

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group