pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Luis Sousa <llsousa@ualg.pt>
To: pgsql sql Mailing List <pgsql-sql@postgresql.org>
Subject: Problems using a rule with the WHERE clause
Date: Mon, 25 Jun 2001 16:08:44 +0100
Message-ID: <3B3753FB.2E1BA9B0@ualg.pt> (raw)

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

view thread (6+ messages)  latest in thread

Message-ID: <3B3753FB.2E1BA9B0@ualg.pt>
Permalink:  ../3B3753FB.2E1BA9B0@ualg.pt/
Also on:    postgresql.org/message-id/3B3753FB.2E1BA9B0@ualg.pt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: llsousa@ualg.pt
  Subject: Re: Problems using a rule with the WHERE clause
  In-Reply-To: <3B3753FB.2E1BA9B0@ualg.pt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox