Re: GUID function in pgsql?

From: Norberto Meijome <sys(at)meijome(dot)net>
To: me(at)alternize(dot)com
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-novice(at)postgresql(dot)org
Subject: Re: GUID function in pgsql?
Date: 2005-12-15 11:51:14
Message-ID: 43A158B2.3010502@meijome.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

me(at)alternize(dot)com wrote:

>> Normally you want to use sequences to do this. If you need something
>> more
>> global you could combine this with some unique ID for your database.
>
>
> normally i would use serials, of course. but not when the tools expect
> a guid (i.e. something like 'a4180365-b4b5-4013-bd7b-7b6a386eb343').
> and as i'm only in control of the DBMS and not the tools itself, i
> will need a guid somehow...
>
Bruno's advise is still valid. If you google around a bit, you'll across
explanations like the one in
http://blogs.msdn.com/oldnewthing/archive/2004/02/11/71307.aspx

on how MS-GUIDs are created. If fitting to your GUID-loving-app is the
key here, you can easily write a function in C or other language that
when called it returns a GUID in the exact format you need.
Somethign like
substr(random(n,m,sha1(rand(ms_since_epoch())))-[unique ID generated
from your MAC address]

or something like that - you get the picture.
B

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2005-12-15 11:52:01 Re: client-server connection
Previous Message me 2005-12-15 11:10:58 Re: GUID function in pgsql?