Luis Sousa <[EMAIL PROTECTED]> writes: > CREATE RULE "updateturnodocente" AS ON UPDATE TO "docentesturno" > WHERE OLD.idpessoal != 0 > DO INSTEAD ( > ... > When I execute the INSERT into de view docentesturno I got the message: > ERROR: Cannot update a view without an appropriate rule You failed to supply a rule covering the case OLD.idpessoal = 0. More specifically, you *must* supply an unconditional INSTEAD rule to replace the attempt to insert/update in the view. Possibly what you want is CREATE RULE "updateturnodocente" AS ON UPDATE TO "docentesturno" WHERE OLD.idpessoal != 0 DO ( ... ); CREATE RULE "updateturnodocente_default" AS ON UPDATE TO "docentesturno" DO INSTEAD NOTHING; Here, the unconditional rule always fires, and the conditional one fires only when its condition is true. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster