Fabio Arias escribió:
Muy Buenos Dias, tengo un problema de urgencia, tengo unas tablas particionadas, pero la regla en UPDATE no me funciona no me actualiza la tabla, y no se que hacer.

CREATE OR REPLACE RULE transaccion_octubre_update_part AS
    ON UPDATE TO "TRANSACCION"
WHERE old."TRAN_FECHA" >= '2009-10-01'::date AND old."TRAN_FECHA" <= '2009-10-31'::date DO INSTEAD UPDATE "TRANSACCION_OCTUBRE" SET "TRAN_ESTADO" = new."TRAN_ESTADO", "TRAN_PREAPROBADA" = new."TRAN_PREAPROBADA"
  WHERE "TRAN_ID" = old."TRAN_ID";



Fabio Hernando Arias Vera
Cel. +57 320 419 2661

Mike Ditka <http://www.brainyquote.com/quotes/authors/m/mike_ditka.html> - "If God had wanted man to play soccer, he wouldn't have given us arms."
¿Por qué cuando le vas a decir a qué tabla le vas a aplicar la regla pones su nombre entre comillas?
¿No debería ser:

CREATE OR REPLACE RULE transaccion_octubre_update_part AS
   ON UPDATE TO TRANSACCION
WHERE old.TRAN_FECHA >= '2009-10-01'::date AND old.TRAN_FECHA <= '2009-10-31'::date DO INSTEAD UPDATE TRANSACCION_OCTUBRE SET TRAN_ESTADO = new.TRAN_ESTADO, TRAN_PREAPROBADA = new.TRAN_PREAPROBADA
 WHERE TRAN_ID = old.TRAN_ID;

Aquí te dejo un ejemplo del libro Apress.Beginning PHP and PostgreSQL 8 From Novice to Professional para la creación de una regla UPDATE:

CREATE RULE database_books_update AS ON UPDATE TO database_books WHERE
NEW.title <> OLD.title DO INSTEAD UPDATE books SET title = NEW.title;


Otra cosa, ¿Pudieras poner tu schema de tus tablas particionadas ?
Para tener una idea de qué quieres hacer.

Saludos



--
--
"For me, the purpose is, at least partly, to have joy. Programmers often
feel joy when they can concentrate on the creative side of programming,
so Ruby is designed to make programmers happy." Yukihiro Matsumoto (Matz), Creator of the Ruby Language

Ing. Marcos Luís Ortíz Valmaseda
System DBA && Rails New User
Centro de Tecnologías de Almacenamiento y Anális de Datos (CENTALAD)
Universidad de las Ciencias Informáticas

Linux User # 418229

http://www.freebsd.org
http://www.postgresql-es.org
http://www.postgresql.org
http://www.planetpostgresql.org
http://www.rubyonrails.org
http://www.ruby-lang.org
--
TIP 1: para suscribirte y desuscribirte, visita 
http://archives.postgresql.org/pgsql-es-ayuda

Responder a