Re: Drawbacks of using BYTEA for PK?

From: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
To: "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Drawbacks of using BYTEA for PK?
Date: 2004-01-12 13:42:36
Message-ID: 4002A44C.1070004@zara.6.isreserved.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bob.Henkel 2004-01-12 14:25:51 Re: what we need to use postgresql in the enterprise
Previous Message Chris Travers 2004-01-12 13:22:27 Re: History-based (or logged) database.