From: Frank Joerdens <frank@joerdens.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Rule trouble (looks to me exactly like the example)
Date: Sun, 7 Apr 2002 16:15:19 +0200
Message-ID: <20020407161519.A9927@superfly.archi-me-des.de> (raw)
In-Reply-To: <24361.1018021338@sss.pgh.pa.us>
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>
On Fri, Apr 05, 2002 at 10:42:18AM -0500, Tom Lane wrote:
> Frank Joerdens <frank@joerdens.de> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: frank@joerdens.de, tgl@sss.pgh.pa.us
Subject: Re: Rule trouble (looks to me exactly like the example)
In-Reply-To: <20020407161519.A9927@superfly.archi-me-des.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox