Received: from megazone23.bigpanda.com ([216.136.151.41]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5IMxVa28589 for ; Mon, 18 Jun 2001 18:59:31 -0400 (EDT) (envelope-from sszabo@megazone23.bigpanda.com) Received: from localhost (sszabo@localhost) by megazone23.bigpanda.com (8.11.2/8.11.2) with ESMTP id f5IMxQP87288; Mon, 18 Jun 2001 15:59:26 -0700 (PDT) Date: Mon, 18 Jun 2001 15:59:25 -0700 (PDT) From: Stephan Szabo To: Stef Telford cc: pgsql-sql@postgresql.org Subject: Re: Referential Integrity Question (Delete/Insert during Transaction) In-Reply-To: <01061816431601.11299@chronozon.artofdns.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200106/281 X-Sequence-Number: 3544 On Mon, 18 Jun 2001, Stef Telford wrote: > > I seem to have hit what i -think- may be a bug (but i am not crying > wolf jst yet ;). > > I have three tables. action, client and order_details. action has a primary > key 'order', client references action (along with adding the client_id as > part of its primary key), order_details references client (both parts of the > primary key there). all foreign keys (order in client and order+client_id in > order_details) are set to INITIALLY DEFERRED. so far so good i hope. > > Now. the way i understand it, shouldnt the integrity of any foreign keys > be checked at the -end- of the transaction, after all the commands have been > processed ? it seems that the DELETE is being processed and rejected, but > the foreign key would be 'okay' due to the following INSERT. I have tried > SET CONSTRAINTS as well with no difference :\ Yes. There's a problem where intermediate conditions are being checked in certain sequences of deferred constraints. It should be fixed for 7.2.