Hi,

I tried to create rule on a view. It should contain a WHERE clause. 
Unfortunately it does not work:

a_4m=# CREATE RULE sharp_p1_rule AS ON SELECT TO sharp
a_4m-#   WHERE part_key = 1
a_4m-#   DO
a_4m-#   INSTEAD SELECT * FROM sharp_p1;
ERROR:  ON SELECT rule may not use OLD

a_4m=# CREATE RULE sharp_p1_rule AS ON SELECT TO sharp
a_4m-#   WHERE NEW.part_key = 1
a_4m-#   DO
a_4m-#   INSTEAD SELECT * FROM sharp_p1;
ERROR:  relation "*NEW*" does not exist

a_4m=# CREATE RULE sharp_p1_rule AS ON SELECT TO sharp
a_4m-#   WHERE OLD.part_key = 1
a_4m-#   DO
a_4m-#   INSTEAD SELECT * FROM sharp_p1;
ERROR:  ON SELECT rule may not use OLD

Is it my mistake, or some feature I did not find in the docs?

regards,

Mariusz

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to