X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 982C3D8307 for ; Fri, 21 Oct 2005 12:01:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32060-03 for ; Fri, 21 Oct 2005 15:01:50 +0000 (GMT) Received: from halfgaar.kicks-ass.net (cc503261-a.eelde1.dr.home.nl [217.121.237.58]) by svr1.postgresql.org (Postfix) with ESMTP id 70E9CD6E47 for ; Fri, 21 Oct 2005 12:01:50 -0300 (ADT) Received: from localhost ([127.0.0.1]) by halfgaar.kicks-ass.net with esmtp (Exim 4.50) id 1ESyOy-0004lo-Rr; Fri, 21 Oct 2005 17:01:48 +0200 Message-ID: <435902DC.3000807@gmail.com> Date: Fri, 21 Oct 2005 17:01:48 +0200 From: Wiebe Cazemier User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050729) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: Delete rule chain stops unexpectedly References: <4358F79B.1000409@gmail.com> <21436.1129905772@sss.pgh.pa.us> In-Reply-To: <21436.1129905772@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.394 required=5 tests=[AWL=-0.448, FORGED_RCVD_HELO=0.05, RCVD_IN_NJABL_DUL=1.655, RCVD_IN_SORBS_DUL=0.137] X-Spam-Level: * X-Archive-Number: 200510/246 X-Sequence-Number: 23099 Tom Lane wrote: > The rule that actually deletes the rows from the underlying has to fire > last, since the rows are gone from the view (and hence from OLD) the > moment you delete them. A quote from the postgresql manual: "But for ON UPDATE and ON DELETE rules, the original query is done after the actions added by rules. This ensures that the actions can see the to-be-updated or to-be-deleted rows" So, the actual delete should be done after all the rules. And even if it does delete before anything else, that does not explain why "step2" is not inserted into the debuglog table. Or, that all the rules _are_ executed when I call the query with "explain analayze".