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

Re: UUID/GUID information

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: David Busby <Busby(at)pnts(dot)com>
Cc: 'Postgres-PHP' <pgsql-php(at)postgresql(dot)org>
Subject: Re: UUID/GUID information
Date: 2002-05-31 12:49:00
Message-ID: 1022849340.30236.220.camel@kant.mcmillan.net.nz (view raw or flat)
Thread:
Lists: pgsql-php
On Fri, 2002-05-31 at 08:05, David Busby wrote:
> 
> The GUID from Micro$oft is formatted like
> {01234567-89AB-CDEF-0123-456789ABCDEF} it represents a 16 byte number that
> is again unique in spacetime.  Is there PostgreSQL solution for something
> like that or will I have to come up with my own.

There is an RFC defining GUID and UUID, and it isn't a major job to
generate them yourself.  If you implement a function to do so you may
want to contribute it back to the PostgreSQL community.

The basic approach uses IP address, date and time and some other stuff I
forget right now.

GUID's are actually pretty neat, because they are sortable, but still
unique, I believe.

It sounds like a straight timestamp + IP address would be sufficient for
you.  In a similar multi-system problem I am working on I actually just
use a two-field key with a serial and a machine name.  Using a machine
name explicitly, and splitting it into a separate field, actually offers
the advantage of making it clearer where the transaction came from, and
consequently how my replication model works.

Steer well clear of OIDs - they are not necessarily persistent over
backup / restore, and they offer little real utility in PostgreSQL these
days being something of an appendix from it's time-travelling days. I
actually disable them on most user tables when running under 7.2.1 .

Regards,
					Andrew.
-- 
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/        PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201    MOB: +64(21)635-694    OFFICE: +64(4)499-2267
       Are you enrolled at http://schoolreunions.co.nz/ yet?


In response to

pgsql-php by date

Next:From: Areski BelaidDate: 2002-05-31 17:57:16
Subject: Incompatibility Postgres 7.1 - Postgres 7.3
Previous:From: Josh BerkusDate: 2002-05-30 23:34:52
Subject: Re: UUID/GUID information

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