X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 02D949DC8DB for ; Mon, 2 Jan 2006 09:26:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07580-06 for ; Mon, 2 Jan 2006 09:26:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pjetlic.mobart.hr (pjetlic.mobart.hr [80.80.51.10]) by postgresql.org (Postfix) with ESMTP id 330AE9DC8A5 for ; Mon, 2 Jan 2006 09:26:13 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by pjetlic.mobart.hr (Postfix) with ESMTP id 4FB52186BE for ; Mon, 2 Jan 2006 14:26:15 +0100 (CET) Received: from pjetlic.mobart.hr ([127.0.0.1]) by localhost (pjetlic [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06999-05-33 for ; Mon, 2 Jan 2006 14:26:15 +0100 (CET) Received: from mike.mobart.hr (mike.mobart.hr [192.168.10.94]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by pjetlic.mobart.hr (Postfix) with ESMTP id 1402B186BA for ; Mon, 2 Jan 2006 14:26:15 +0100 (CET) Subject: PostgreSQL and uuid/guid From: Mario Splivalo Reply-To: mario.splivalo@mobart.hr To: pgsql-sql@postgresql.org Content-Type: text/plain Organization: Mob-Art Date: Mon, 02 Jan 2006 14:26:14 +0100 Message-Id: <1136208374.11482.31.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by OpenSource AV+AS Mail Server X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200601/7 X-Sequence-Number: 23796 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."