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


---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster

Reply via email to