view rules

From: Oleg Lebedev <olebedev(at)waterford(dot)org>
To: Postgres SQL Mailing List <pgsql-sql(at)postgresql(dot)org>
Subject: view rules
Date: 2001-12-06 20:17:44
Message-ID: 3C0FD268.DFFA9CB8@waterford.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi everybody,
I am trying to create an update rule for a view. It's created fine, and
I can find it in pg_rules, but when I try to update the view, I get the
usual error:
ERROR: Cannot update a view without an appropriate rule.

My rule definitions is as follows:
CREATE RULE update_priority AS ON UPDATE TO progress_report
WHERE NEW.priority != OLD.priority
DO INSTEAD UPDATE activity SET priority=NEW.priority
WHERE activity.productcode = OLD.product_code
AND activity.actname=OLD.component;

I am trying to update the view as follows:
update progress_report set priority=2 where product_code='m3' and
component='act';

activity is a table. I can't figure out what's wrong. Please help.
thanks,

Oleg

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gregory Wood 2001-12-06 20:37:23 Re: update returns 1, but no changes have been made
Previous Message Bruno Wolff III 2001-12-06 20:05:32 Re: update with RE