Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 11C4F9F977C for ; Fri, 7 Sep 2007 12:36:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 24530-03-3 for ; Fri, 7 Sep 2007 12:36:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 91A2F9F9C8C for ; Fri, 7 Sep 2007 12:36:04 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l87Fa3iv022419; Fri, 7 Sep 2007 11:36:03 -0400 (EDT) To: Julius Stroffek cc: pgsql-bugs@postgresql.org Subject: Re: 'on insert do instead' rule with a where clause responds 'INSERT 0 0' In-reply-to: <46E16058.4070602@Sun.COM> References: <46E16058.4070602@Sun.COM> Comments: In-reply-to Julius Stroffek message dated "Fri, 07 Sep 2007 16:29:44 +0200" Date: Fri, 07 Sep 2007 11:36:03 -0400 Message-ID: <22418.1189179363@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/48 X-Sequence-Number: 18275 Julius Stroffek writes: > Attached is the example script 'repro.sql' which creates two relations > tab1 and tab2. It also creates a rule on tab1 which simply does insert > into tab2. The insert statement into tab1 is executed afterwards. It > responds with 'INSERT 0 1'. However if I would create the same rule with > the where clause the response to the same insert statement is 'INSERT 0 > 0'. The output of the script executed through psql is in 'repro.out'. > Is this a bug? No. See http://www.postgresql.org/docs/8.2/static/rules-status.html and note that you don't have an unconditional INSTEAD rule. regards, tom lane