Received: from megazone.bigpanda.com ([63.150.15.178]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fAK89Qm68675 for ; Tue, 20 Nov 2001 03:09:26 -0500 (EST) (envelope-from sszabo@megazone23.bigpanda.com) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 082A9D5E6; Tue, 20 Nov 2001 00:09:27 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id F20025BE7; Tue, 20 Nov 2001 00:09:26 -0800 (PST) Date: Tue, 20 Nov 2001 00:09:26 -0800 (PST) From: Stephan Szabo To: Cc: Subject: Re: Foreign Key Constraint Deletion Order In-Reply-To: <200111200350.0341@lh00.opsion.fr> Message-ID: <20011119235947.T53451-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200111/289 X-Sequence-Number: 5671 On Tue, 20 Nov 2001 cnliou@eurosport.com wrote: > This is really a pain though it works. > > Since delete from PurchaseMaster and PurchaseDetail > are both possible, two subtraction trigger functions > must be written for PurchaseMaster and > PurchaseDetail, respectively. > > It also seems unwise not to use the > powerful-but-easy-to-use RI capability (on delete > cascade on update cascade) but to implement it with > my own trigger to be fired by PurchaseMaster. Yeah, there's also some locking gotchas involved so while the RI stuff isn't nearly perfect it's probably a good idea to stick with it unless you're running one of the problem cases. > If the delete was always done on PurchaseDetail > before PurchaseMaster, then one subtraction function > for PurchaseDetail along with the RI would settle > down everything. > > Am I asking for too much, or RI and triggers were not > designed for operations like this example in the > first place? For the particular case you're looking for I don't think so. It sounds like it'd make sense, but I don't think it'd fit the spec wording (given that we've been arguing how far after the deletion that the cascade occurs, I don't think anyone's argued for before the deletion).