From: | Luis Sousa <llsousa(at)ualg(dot)pt> |
---|---|
To: | pgsql sql Mailing List <pgsql-sql(at)postgresql(dot)org> |
Subject: | Problems using a rule with the WHERE clause |
Date: | 2001-06-25 15:08:44 |
Message-ID: | 3B3753FB.2E1BA9B0@ualg.pt |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello
I'm using a rule without a WHERE clause that's working fine. Now a have
to put a where clause because I only want the rule be get executed only
in some occasions, but I'm having some problems with that.
This rule is over a view called docentesturno.
The code that I was using in the rule when I didn't had the WHERE clause
was:
CREATE RULE "updateturnodocente" AS ON UPDATE TO "docentesturno"
DO INSTEAD (
UPDATE "pessoalEvento"
SET "idPessoal" = NEW."idpessoal",
ponderacao = NEW.ponderacao,
envolvimento = NEW.envolvimento
WHERE id_pe = OLD.id_pe;
);
Now the code for the rule with WHERE:
CREATE RULE "updateturnodocente" AS ON UPDATE TO "docentesturno"
WHERE OLD.idpessoal != 0
DO INSTEAD (
UPDATE "pessoalEvento"
SET "idPessoal" = NEW."idpessoal",
ponderacao = NEW.ponderacao,
envolvimento = NEW.envolvimento
WHERE id_pe = OLD.id_pe;
);
When I execute the INSERT into de view docentesturno I got the message:
ERROR: Cannot update a view without an appropriate rule
Do someone knows what can be the problem in this rule?
Apparently I'm doing in the same way of the manual, chapter 13.7.2
!!!!!!!
Best regards
Luis Sousa
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2001-06-25 16:22:56 | Re: Foreign key problem |
Previous Message | Itai Zukerman | 2001-06-25 14:07:21 | Re: Foreign key problem |