pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: nathan wagner <nw@hydaspes.if.org>
To: pgsql-hackers@postgresql.org
Subject: Re: uuid type for postgres
Date: Wed, 7 Sep 2005 02:36:06 +0000
Message-ID: <20050907023606.GA2181@granicus.if.org> (raw)
In-Reply-To: <200509061840.28068.josh@agliodbs.com>
References: <20050906135057.GA24136@granicus.if.org>
	<200509061802.51089.josh@agliodbs.com>
	<20050907011135.GA7369@mark.mielke.cc>
	<200509061840.28068.josh@agliodbs.com>

On Tue, Sep 06, 2005 at 06:40:27PM -0700, josh@agliodbs.com wrote:
 
> Sure.  What's a UUID, after all?   It's three pieces of information:
> 1) A server or database instance identifier
> 2) A table identifier
> 3) A row identifier
> 
> e.g.:
> chayote.sf.agliodbs.com | public.customers | 4271
> 
> Generally, it's pretty easy to just grab these 3 pieces of information 
> separately and pass them with the data when you want to transmit between 
> servers.  If there are space/overhead considerations, you can put them 
> into a reversable hash.

Take a look at the version 3 or version 5 UUIDs.  They essentially do this.
The hash isn't reversable, but rather recreatable.  Seems that if it
were reversable, it would be compression, not a hash.  Anyway.

You're assuming though that you want to leak this information.  If you do,
or you don't care, go ahead with the v3 or v5 uuid creator.

Or use v1 if you want mac/time based uuids, or v4 for random uuids.

The convenient thing about using the uuid library is that all of these
mechanisms result in the same type, and are thus compatible.

> I've never understood the complex measures which 
> application developers take to create "universal" IDs.

Different applications have different goals.  Unguessability might
be important in some contexts.

-- 
Nathan Wagner



view thread (51+ messages)  latest in thread

Message-ID: <20050907023606.GA2181@granicus.if.org>
Permalink:  ../20050907023606.GA2181@granicus.if.org/
Also on:    postgresql.org/message-id/20050907023606.GA2181@granicus.if.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: nw@hydaspes.if.org, pgsql-hackers@postgresql.org
  Subject: Re: uuid type for postgres
  In-Reply-To: <20050907023606.GA2181@granicus.if.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox