Problems using a rule with the WHERE clause
От | Luis Sousa |
---|---|
Тема | Problems using a rule with the WHERE clause |
Дата | |
Msg-id | 3B3753FB.2E1BA9B0@ualg.pt обсуждение исходный текст |
Ответы |
Re: Problems using a rule with the WHERE clause
|
Список | pgsql-sql |
Hello <p>I'm using a rule without a WHERE clause that's working fine. Now a have to put a where clause because I only wantthe rule be get executed only in some occasions, but I'm having some problems with that. <p>This rule is over a viewcalled docentesturno. <p>The code that I was using in the rule when I didn't had the WHERE clause was: <p><b>CREATE RULE"updateturnodocente" AS ON UPDATE TO "docentesturno"</b><br /><b> DO INSTEAD (</b><br /><b> UPDATE "pessoalEvento"</b><br/><b> SET "idPessoal" = NEW."idpessoal",</b><br /><b> ponderacao = NEW.ponderacao,</b><br /><b> envolvimento = NEW.envolvimento</b><br /><b> WHERE id_pe = OLD.id_pe;</b><br /><b> );</b><br /> <p>Now the codefor the rule with WHERE: <p><b>CREATE RULE "updateturnodocente" AS ON UPDATE TO "docentesturno"</b><br /><b> WHERE OLD.idpessoal!= 0</b><br /><b> DO INSTEAD (</b><br /><b> UPDATE "pessoalEvento"</b><br /><b> SET "idPessoal" = NEW."idpessoal",</b><br/><b> ponderacao = NEW.ponderacao,</b><br /><b> envolvimento = NEW.envolvimento</b><br /><b> WHERE id_pe = OLD.id_pe;</b><br /><b> );</b><b></b><p>When I execute the INSERT into de view docentesturno I got themessage: <br /> ERROR: Cannot update a view without an appropriate rule <br /> <p>Do someone knows what canbe the problem in this rule? <br />Apparently I'm doing in the same way of the manual, chapter 13.7.2 !!!!!!! <br /> <br /> <p>Best regards <p>Luis Sousa
В списке pgsql-sql по дате отправления: