Hello,
I came up against the same (or similar) difficulty some month ago.
Then Tom Lane suggested me to write a simple sql or plpgsql function which handles the multiple delete action.
(BTW, maybe you don't want to use the on delete cascade referential integrity in some cases.)
Sorry, but I can't find anywhere the answer sent me.
But here's the source code of the function I wrote:
create function f_privateauto_del(ID) returns BOOLEAN as
'DECLARE ID INTEGER;
BEGIN
SELECT INTO ID c_id FROM t_one WHERE t_one.c_id = $1;
IF NOT FOUND THEN RAISE EXCEPTION ''Illegal parameter''; END IF; -- this isn't necessary
DELETE FROM t_one WHERE oid = $1;
DELETE FROM t_two WHERE c_id = ID;
RETURN true::BOOLEAN;
END;'
language 'plpgsql';
You can figure out from my original letter (below) how much your problems is similar to the one I had.
Papp Gyozo
- pgerzson@freestart.hu