Thread: Missing inserts

Missing inserts

From
Martín Marqués
Date:
For some reason, I seam to feel as if the inserts that should be executed by 
a rule are not all getting executed, or at least, they are not getting writen.

How can I find out what the rule is really doing? The logs don't say much.

Any help will be grear at this moment of stress!!! X->

Saludos... :-)

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        mmarques@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telematica                      Universidad Nacional
        del Litoral
 
-----------------------------------------------------------------


Re: Missing inserts

From
Bruce Momjian
Date:
In 7.1.X and earlier the INSERT rules are executed _before_ the INSERT. 
This is changed to _after_ in 7.2.

> For some reason, I seam to feel as if the inserts that should be executed by 
> a rule are not all getting executed, or at least, they are not getting writen.
> 
> How can I find out what the rule is really doing? The logs don't say much.
> 
> Any help will be grear at this moment of stress!!! X->
> 
> Saludos... :-)
> 
> -- 
> Porqu? usar una base de datos relacional cualquiera,
> si pod?s usar PostgreSQL?
> -----------------------------------------------------------------
> Mart?n Marqu?s                  |        mmarques@unl.edu.ar
> Programador, Administrador, DBA |       Centro de Telematica
>                        Universidad Nacional
>                             del Litoral
> -----------------------------------------------------------------
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: Missing inserts

From
Martín Marqués
Date:
On Mar 02 Oct 2001 21:59, you wrote:
> In 7.1.X and earlier the INSERT rules are executed _before_ the INSERT.
> This is changed to _after_ in 7.2.

This would mean...??? I haven´t had much trouble until now, so I can´t 
understand why one of the 4 inserts of the rule didn´t get through.

Is there some logic?

TIA!

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        mmarques@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telematica                      Universidad Nacional
        del Litoral
 
-----------------------------------------------------------------


Re: Missing inserts

From
Martín Marqués
Date:
On Mié 03 Oct 2001 16:43, you wrote:
> On Mar 02 Oct 2001 21:59, you wrote:
> > In 7.1.X and earlier the INSERT rules are executed _before_ the INSERT.
> > This is changed to _after_ in 7.2.
>
> This would mean...??? I haven´t had much trouble until now, so I can´t
> understand why one of the 4 inserts of the rule didn´t get through.

Sorry for answering my own mail, but I found some info.

This is my rule:

CREATE RULE admin_insert AS ON 
INSERT TO admin_view
DO INSTEAD (  INSERT INTO carrera   (carrera,titulo,area,descripcion,incumbencia,director,
matricula,cupos,informes,nivel,requisitos,duracion, categoria)  VALUES
(new.carrera,new.titulo,new.id_subarea,new.descripcion, new.incumbencia,new.director,new.matricula,new.cupos,
new.informes,new.nivel,new.requisitos,new.duracion, new.car_categ);
 
  INSERT INTO inscripcion  (carrera,fecha_ini,fecha_fin,lugar)  VALUES
(currval('carrera_id_curso_seq'),new.fecha_ini,new.fecha_fin, new.lugar);
 
  INSERT INTO resol  (carr,numero,year,fecha)  VALUES
(currval('carrera_id_curso_seq'),new.numero,new.year,new.fecha);
  INSERT INTO log_carrera (accion,tabla,id_col) VALUES   ('I','carrera',currval('carrera_id_curso_seq'));
);

All inserts to the tables are done to the view (so this rule is used), but I 
have 39 of a total of 142 inserts that didn't get the second insert of the 
rule to go.

The question is why is this happening, and how can I fix it?

If you need logs or something, I have no problem at all.

Saludos... :-)

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        mmarques@unl.edu.ar
Programador, Administrador, DBA |       Centro de Telematica                      Universidad Nacional
        del Litoral
 
-----------------------------------------------------------------