Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id B8C074759EA for ; Fri, 5 Apr 2002 10:42:20 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g35FgJF24364; Fri, 5 Apr 2002 10:42:19 -0500 (EST) To: Frank Joerdens Cc: pgsql-sql@postgresql.org Subject: Re: Rule trouble (looks to me exactly like the example) In-reply-to: <20020405120851.D30469@superfly.archi-me-des.de> References: <20020404191719.C30469@superfly.archi-me-des.de> <25306.1017948553@sss.pgh.pa.us> <20020405120851.D30469@superfly.archi-me-des.de> Comments: In-reply-to Frank Joerdens message dated "Fri, 05 Apr 2002 12:08:51 +0200" Date: Fri, 05 Apr 2002 10:42:18 -0500 Message-ID: <24361.1018021338@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200204/67 X-Sequence-Number: 7332 Frank Joerdens writes: >> What's happening is that "new.id" is effectively still NULL at the point >> where the rule is processed, so the rule WHERE condition fails. I'm not >> sure why you're bothering with that WHERE condition anyway ... > Without the WHERE condition, all rows are affected by the update, and > not just the newly inserted one. I was speaking of the WHERE new.id > 0 part. However, given that you want to affect only the newly-inserted row, ISTM you'd be a lot better off with a trigger instead of a rule. regards, tom lane