Received: from superfly.archi-me-des.de (unknown [62.8.212.177]) by postgresql.org (Postfix) with ESMTP id 1B7D047586D for ; Sun, 7 Apr 2002 10:08:54 -0400 (EDT) Received: (from frank@localhost) by superfly.archi-me-des.de (8.9.3/8.9.3) id QAA09961; Sun, 7 Apr 2002 16:15:19 +0200 Date: Sun, 7 Apr 2002 16:15:19 +0200 From: Frank Joerdens To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: Rule trouble (looks to me exactly like the example) Message-ID: <20020407161519.A9927@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> <24361.1018021338@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.1.2i In-Reply-To: <24361.1018021338@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Fri, Apr 05, 2002 at 10:42:18AM -0500 X-Subliminal-Message: Use Linux! Use Linux! X-Archive-Number: 200204/81 X-Sequence-Number: 7346 On Fri, Apr 05, 2002 at 10:42:18AM -0500, Tom Lane wrote: > 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. Oh yes, that's silly indeed. I just put it there to make the query look like the example. > 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. I'll give that a try! Thanks, Frank