pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL and uuid/guid
2+ messages / 2 participants
[nested] [flat]

* PostgreSQL and uuid/guid
@ 2006-01-02 13:26  Mario Splivalo <mario.splivalo@mobart.hr>
  0 siblings, 1 reply; 2+ messages in thread

From: Mario Splivalo @ 2006-01-02 13:26 UTC (permalink / raw)
  To: pgsql-sql

Hello all.

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.

Let's pretend for a moment here that I'm not satisfied with any other
solution (for instance, assigning IDs for each replication 'subscriber',
and then combining that ID with sequence generated numbers to have
unique ID's within the replication system), and that I realy need
guid/uids.

I've found source code for the guid/uuid.  There is a program, called
uuidgen, wich creates the uuid. uuidgen is part of the libuuid1 package
from Debian/GNU. The sources are in the e2fsprogs pacgages, where I
found the source for the uuidgen.

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.

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.

	Mario
-- 
Mario Splivalo
Mob-Art
mario.splivalo@mobart.hr

"I can do it quick, I can do it cheap, I can do it well. Pick any two."





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PostgreSQL and uuid/guid
@ 2006-01-06 02:38  george young <gry@ll.mit.edu>
  parent: Mario Splivalo <mario.splivalo@mobart.hr>
  0 siblings, 0 replies; 2+ messages in thread

From: george young @ 2006-01-06 02:38 UTC (permalink / raw)
  To: mario.splivalo@mobart.hr; +Cc: pgsql-sql

On Mon, 02 Jan 2006 14:26:14 +0100
Mario Splivalo <mario.splivalo@mobart.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)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-01-06 02:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-02 13:26 PostgreSQL and uuid/guid Mario Splivalo <mario.splivalo@mobart.hr>
2006-01-06 02:38 ` george young <gry@ll.mit.edu>

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