Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 571919FB5EA for ; Sat, 21 Apr 2007 13:18:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 18221-04 for ; Sat, 21 Apr 2007 13:18:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by postgresql.org (Postfix) with ESMTP id 2BE6B9FB5DC for ; Sat, 21 Apr 2007 13:18:17 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 44203350E3; Sat, 21 Apr 2007 09:18:16 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 41A6E350CC; Sat, 21 Apr 2007 09:18:16 -0700 (PDT) Date: Sat, 21 Apr 2007 09:18:16 -0700 (PDT) From: Stephan Szabo To: cluster Cc: pgsql-performance@postgresql.org Subject: Re: FK triggers misused? In-Reply-To: Message-ID: <20070421090141.R65163@megazone.bigpanda.com> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/359 X-Sequence-Number: 24236 On Sat, 21 Apr 2007, cluster wrote: > I have investigated a bit now and found the following: > > When I perform the update the *first* time, the triggers are actually > not evaluated. But from the second update they are. Are these in one transaction? If so, then right now after the first update, the remaining updates will trigger checks if the row modified was modified in this transaction. The comment in trigger.c lists the basic circumstance, although it mentions it in terms of insert and a deferred FK, I would guess that if there's ever a possibility of two modifications (including multiple updates or on an immediate constraint) before the constraint check occurred the same condition could happen.