Re: Deleting Problem - Mailing list pgsql-general

From Reece Hart
Subject Re: Deleting Problem
Date
Msg-id 1162255825.4583.96.camel@snafu.site
Whole thread Raw
In response to Deleting Problem  (Jamie Deppeler <jamie@doitonce.net.au>)
List pgsql-general
On Tue, 2006-10-31 at 10:24 +1100, Jamie Deppeler wrote:
Here is my problem i have delete triggers on table5 and table6 which
update summary information on table1,table2,table3,table4 if table5 or 6
gets delete, problem i am faced with is when eg table1 record gets
deleted i get the following error Error insert or update on table5
violates foreign key constraint "table4". They are all link with a
cascade delete.

As Stephen said, it's difficult to help without more details about the triggers and the structure of your transaction. However, if you expect that the constraints are consistent at the end of the transaction, perhaps the problem is merely the order in which constraints are checked. See

http://www.postgresql.org/docs/8.1/interactive/sql-set-constraints.html

and consider something like SET CONSTRAINTS ALL DEFERRED .

-Reece

-- 
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0

pgsql-general by date:

Previous
From: Reece Hart
Date:
Subject: Re: creating a dumpfile from a view
Next
From: "Hakka Ville"
Date:
Subject: limiting connections on "per database/per user" basis