Re: Drawbacks of using BYTEA for PK? - Mailing list pgsql-general

From David Garamond
Subject Re: Drawbacks of using BYTEA for PK?
Date
Msg-id 4002A44C.1070004@zara.6.isreserved.com
Whole thread Raw
In response to Re: Drawbacks of using BYTEA for PK?  ("D. Dante Lorenso" <dante@lorenso.com>)
Responses Re: Drawbacks of using BYTEA for PK?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Drawbacks of using BYTEA for PK?  (Alex Satrapa <alex@lintelsys.com.au>)
List pgsql-general
D. Dante Lorenso wrote:
> GUID?  Isn't that really nothing more than an MD5 on a sequence?
>
>    SELECT (MD5(NEXTVAL('my_table_seq'))) AS my_guid;

I know there are several algorithms to generate GUID, but this is
certainly inadequate :-) You need to make sure that the generated GUID
will be unique throughout cyberspace (or to be more precise, the GUID
should have a very very small chance of colliding with other people's
GUID). Even OID is not a good seed at all.

Perhaps I can make a GUID by MD5( two random numbers || a timestamp || a
unique seed like MD5 of '/sbin/ifconfig' output)...

> Since 7.4 has the md5 function built-in, there's your support ;-)

Well, until there's a GUID or INT128 or BIGBIGINT builtin type I doubt
many people will regard PostgreSQL as fully supporting GUID. I believe
there's the pguuid project in GBorg site that does something like this.

--
dave


pgsql-general by date:

Previous
From: "Chris Travers"
Date:
Subject: Re: History-based (or logged) database.
Next
From: Bob.Henkel@hartfordlife.com
Date:
Subject: Re: what we need to use postgresql in the enterprise