GUIDs

From: David Wheeler <david(at)kineticode(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: GUIDs
Date: 2003-11-14 00:57:33
Message-ID: 87E84E56-163D-11D8-9545-0003931A964A@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)kineticode(dot)com ICQ: 15726394
http://www.kineticode.com/ Yahoo!: dew7e
Jabber: Theory(at)jabber(dot)org
Kineticode. Setting knowledge in motion.[sm]

Responses

  • Re: GUIDs at 2003-11-14 01:04:35 from Peter Eisentraut
  • Re: GUIDs at 2003-11-14 05:04:29 from Bruno Wolff III

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2003-11-14 01:04:35 Re: GUIDs
Previous Message Chris Stokes 2003-11-14 00:51:13 Re: Database Corruption ?