From: | Robert Fitzpatrick <robert(at)webtent(dot)com> |
---|---|
To: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | DELETE and UPDATE in same function with foriegn keys |
Date: | 2004-08-09 16:36:57 |
Message-ID: | 1092069416.1964.68.camel@columbus.webtent.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have tblhud74b that has a foreign key to tblhudunits with Restrict
Updates. I have a function that DELETEs corresponding records before
doing an UPDATE right after the DELETE statement and receive the
following error:
ERROR: update or delete on "tblhudunits" violates foreign key
constraint "tblhudunitstblhud74b_fk" on "tblhud74b"
DETAIL: Key (similar_group_id,sort_order)=(18,1) is still referenced
from table "tblhud74b".
It seems the DELETE is not posted before the UPDATE happens, hence the
error, right? I tried setting the Foreign Key to DEFERRABLE INITIALLY
DEFERRED, but does not seem to work. Is there a way to do this without
having to set my Foreign Key to Update instead of Restrict. That works
if I do that.
--
Robert
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2004-08-09 16:53:23 | Re: pg jdbc driver |
Previous Message | lec | 2004-08-09 16:14:02 | Re: Losing records when server hang |