Received: from candle.pha.pa.us (root@s5-03.ppp.op.net [209.152.195.67]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA63605 for ; Tue, 7 Mar 2000 10:04:52 -0500 (EST) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id JAA19804; Tue, 7 Mar 2000 09:36:02 -0500 (EST) From: Bruce Momjian Message-Id: <200003071436.JAA19804@candle.pha.pa.us> Subject: Re: [GENERAL] Trigger In-Reply-To: <13288F4408ADD11186FF0060B06A431303648CA2@MSGWAW1> from Andrzej Mazurkiewicz at "Mar 7, 2000 02:11:23 pm" To: Andrzej Mazurkiewicz Date: Tue, 7 Mar 2000 09:36:02 -0500 (EST) CC: "'Raigo Lukk'" , pgsql-general@postgreSQL.org, wieck@debis.com X-Mailer: ELM [version 2.4ME+ PL72 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > Switch to v7.0 beta1 and use FOREIGN KEY. You will save a lot of time. > Before you really finish your development there will be 7.0 production (this > is my private estimation). > Andrzej Mazurkiewicz > > > I am trying to create a trigger for a detail table to check that value > > what is entered exists in master table. > > For example into CustomerOrder table could not be enterd order for > > Customer what does not exists. Not only that he'll save some time. Without the deferred trigger queue manager, watching that one and the same row cannot be modified twice inside of one transaction (WRT key changes), it's possible to fool the trigger and end up with inconsistent data in a multiuser environment. And don't forget that the INSERT of the FK and the DELETE of the PK can happen simultaneously. Due to MVCC, both transactions don't know about each other (thanks to Vadim). Jan from Philly -- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026