Re: PostgreSQL and uuid/guid

From: george young <gry(at)ll(dot)mit(dot)edu>
To: mario(dot)splivalo(at)mobart(dot)hr
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: PostgreSQL and uuid/guid
Date: 2006-01-06 02:38:32
Message-ID: 20060105213832.08806c30.gry@ll.mit.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, 02 Jan 2006 14:26:14 +0100
Mario Splivalo <mario(dot)splivalo(at)mobart(dot)hr> threw this fish to the penguins:

> While browsing the web I've seen that many people 'need' the ability to
> create uuid/guid values from within the PostgreSQL. Most of them are
> switching from MSSQL, and they're missing the newid() function, which in
> MSSQL created the uuid/guid value.
>
> Now I'm in need of such function too. I'm finaly putting together
> MSSQL-like-merge-replication for PostgreSQL, and the guid/uuid values
> would come more than handy here.
...
> Now, it should be possible to create postgresql function (in python,
> forn instance) wich would call the uuidgen program, but that approach
> seems rather slow.

Since it looks like you are familiar with python, you could try a uuid generator in pure python -- here's one I played with a while ago:
(don't know if it's still maintained, but there are others if you search comp.lang.python).

http://www.alcyone.com/pyos/uid/

> I'd like to have postgresql function written in C that would call
> uuid_generate
> (http://www.die.net/doc/linux/man/man3/uuid_generate.3.html).
> Considering what is said for the uuidgen manpage (concerning random and
> pseudorandom generated numbers) I feel that uuids generated this way are
> what I need.
>
> What is the general feeling concerning the uuid issue I explained above?
> I've never written a C postgreSQL function, and any help (or
> documentation pointout) would be greatly appreciated.
> If I posted this to the wrong mailing list, please point me out to the
> correct one.

You question is quite welcome here!

-- George Young
--
"Are the gods not just?" "Oh no, child.
What would become of us if they were?" (CSL)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message alex-lists-pgsql 2006-01-06 18:42:27 INSERT waiting under heavy load
Previous Message Marc G. Fournier 2006-01-06 01:23:18 Re: FOREIGN KEYs ... I think ...