Search Postgresql Archives

Re: GUID for postgreSQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



smarlowe@xxxxxxxxxxxxxxxxx (Scott Marlowe) writes:
> On Wed, 2005-07-27 at 15:32, John DeSoi wrote:
>> On Jul 27, 2005, at 4:49 AM, Tino Wildenhain wrote:
>> 
>> > I'd create a sequence:
>> >
>> > CREATE SEQUENCE global_unique_id_seq;
>> >
>> > and a function:
>> >
>> > CREATE OR REPLACE FUNCTION newid()
>> >   RETURNS text AS
>> > $BODY$ SELECT nextval('global_unique_id_seq')::text; $BODY$
>> >   LANGUAGE 'sql' VOLATILE;
>> >
>> >
>> > now every call to newid() returns a garantied unique id for
>> > say the next 18446744073709551616 calls.
>> > Of course you can obfuscate the ID even more using
>> > md5, include servername and so on, but this will not improve
>> > security in any way (unless you mix data with 2nd database)
>> 
>> 
>> This is not really a viable replacement for a GUID == globally unique  
>> identifier. Here global means that if I use the application in  
>> multiple databases, I'm guaranteed that no two identifiers will be  
>> the same. Using a sequence will only support uniqueness for a single  
>> database.
>
> So, how can two databases, not currently talking to one another,
> guarantee that their GUIDs don't collide? using a large randomly
> generated name space only reduces the chances of collision, it doesn't
> actually guarantee it.

Consult RFC 4122...

  <http://www.ietf.org/rfc/rfc4122.txt>

"Abstract

   This specification defines a Uniform Resource Name namespace for
   UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally
   Unique IDentifier).  A UUID is 128 bits long, and can guarantee
   uniqueness across space and time.  UUIDs were originally used in the
   Apollo Network Computing System and later in the Open Software
   Foundation's (OSF) Distributed Computing Environment (DCE), and then
   in Microsoft Windows platforms.

   This specification is derived from the DCE specification with the
   kind permission of the OSF (now known as The Open Group).
   Information from earlier versions of the DCE specification have been
   incorporated into this document."

See also the gBorg "pgUUID" project:
  <http://gborg.postgresql.org/project/pguuid/projdisplay.php>
-- 
(format nil "~S@~S" "cbbrowne" "acm.org")
http://www.ntlug.org/~cbbrowne/sap.html
Rules of the Evil Overlord #78.  "I will not tell my Legions of Terror
"And he must  be taken alive!" The command will be:  ``And try to take
him alive if it is reasonably practical.''"
<http://www.eviloverlord.com/>

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux