Re: Rule trouble (looks to me exactly like the example)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frank Joerdens <frank(at)joerdens(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Rule trouble (looks to me exactly like the example)
Date: 2002-04-05 15:42:18
Message-ID: 24361.1018021338@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Frank Joerdens <frank(at)joerdens(dot)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. 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-04-05 16:30:08 Re: 16 parameter limit
Previous Message Michael Adler 2002-04-05 14:28:51 Re: FULL JOIN with 3 or more tables