[SQL] PostgreSQL and uuid/guid

2006-01-02 Thread Mario Splivalo
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
[EMAIL PROTECTED]

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



---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[SQL] delete from a using b in postgres 8.1.

2006-01-02 Thread Peter Childs
a command such as

delete from a using b where a. and b.two='foo';

works fine in 8.1 but fails totally in 8.0 however

delete from a where a. and b.two='foo';

works fine in 8.0 and bellow but fails in 8.1 unless you have the add_missing_from option set to true in 8.1 
Even then it produces a nasty warning.

This can break tones of clients admittedly the work around is quick but
not particularly neat. What do the other sql database do and is this
just another inconstancy in SQL?

I realise this was done to fix a bug but its a nasty sitting there that
many client developers are going to miss it before it goes back to the
end user. I also don't think this has been made particularly
clear in changes.

Peter Childs