GUIDs - Mailing list pgsql-general

From David Wheeler
Subject GUIDs
Date
Msg-id 87E84E56-163D-11D8-9545-0003931A964A@kineticode.com
Whole thread Raw
Responses Re: GUIDs  (Peter Eisentraut <peter_e@gmx.net>)
Re: GUIDs  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-general
Hi All,

I want to use GUIDs for object IDs in my application. This means that
they would be used for primary keys in PostgreSQL, and there would of
course be FKs pointing to them. A GUID is 128 bits, and can be in the
following possible formats:

* 16 byte binary (but then I'd have to convert it to hex in my app)
* 32 byte string (e.g., '4162F7121DD211B2B17EC09EFE1DC403')
* hex string (e.g., 0x3271839C163D11D891F785398CC7932E)
* Base 64 string (e.g., 'MnIAdBY9EdiR94U5jMeTLg==')

It looks like the hex option would be the best option, but there's no
native hex format in PostgreSQL. Anyone have suggestions on what the
best approach might be? I can't convert it to a number, really, because
128 bit numbers aren't too portable).

Please Cc any replies to me, as I'm not subscribed to the mail list.

Many TIA,

David

--
David Wheeler                                     AIM: dwTheory
david@kineticode.com                              ICQ: 15726394
http://www.kineticode.com/                     Yahoo!: dew7e
                                                Jabber: Theory@jabber.org
Kineticode. Setting knowledge in motion.[sm]


pgsql-general by date:

Previous
From: "Chris Stokes"
Date:
Subject: Re: Database Corruption ?
Next
From: Peter Eisentraut
Date:
Subject: Re: GUIDs