Rules on select

From: Mariusz Czułada <manieq(at)idea(dot)net(dot)pl>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Rules on select
Date: 2005-01-17 12:28:40
Message-ID: 200501171328.40144.manieq@idea.net.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rick Schumeyer 2005-01-17 13:39:36 Re: Rules on select
Previous Message Antony Paul 2005-01-17 11:59:19 Re: ORDER BY in UNION query