Re: Deleting Problem

From: Reece Hart <reece(at)harts(dot)net>
To: Jamie Deppeler <jamie(at)doitonce(dot)net(dot)au>
Cc: General PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Deleting Problem
Date: 2006-10-31 00:50:25
Message-ID: 1162255825.4583.96.camel@snafu.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hakka Ville 2006-10-31 01:17:01 limiting connections on "per database/per user" basis
Previous Message Reece Hart 2006-10-31 00:43:23 Re: creating a dumpfile from a view