Re: [BUGS] RULES doesn't work as expected

2005-01-12 Thread Richard Huxton
John Hansen wrote: Right, except: create table test (a text, b int); create or replace rule test_rule as on insert to test where exists(select 1 from test where a = NEW.a) do instead select * from test; insert into test (a,b) VALUES ('first',2); a | b ---+--- first | 2 (1 row) select * from t

Re: [BUGS] RULES doesn't work as expected

2005-01-12 Thread John Hansen
essage- > From: Richard Huxton [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 12, 2005 10:22 PM > To: John Hansen > Cc: pgsql-bugs@postgresql.org > Subject: Re: [BUGS] RULES doesn't work as expected > > Removed cc to pgsql-patches since that's not the li

Re: [BUGS] RULES doesn't work as expected

2005-01-12 Thread Richard Huxton
Removed cc to pgsql-patches since that's not the list for this. John Hansen wrote: It seems rules don't work as expected. I could be wrong,... In which case, what am I doing wrong? A rule is like a macro, rewriting the query plan. You're trying to use it as though it is a trigger. The side-effects