pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
loop on a rule
3+ messages / 2 participants
[nested] [flat]

* loop on a rule
@ 2001-08-07 22:22  Martín Marqués <martin@bugs.unl.edu.ar>
  0 siblings, 1 reply; 3+ messages in thread

From: Martín Marqués @ 2001-08-07 22:22 UTC (permalink / raw)
  To: pgsql-sql

As I said before, I am playing around with views and rules, and found out 
that I have something wrong in one of the rules. My delete rule says 
something like this:

CREATE RULE admin_delete AS ON
DELETE TO admin_view
DO INSTEAD (
   DELETE FROM carrera WHERE id_curso=old.id_curso;
   DELETE FROM inscripcion WHERE carrera=old.id_curso;
   DELETE FROM resol WHERE carr=old.id_curso;
   DELETE FROM modalidad WHERE carrera=old.id_curso;
   INSERT INTO log_carrera (accion,tabla) VALUES ('D','carrera');
);

Where id_curso is an identifier to which inscripcion.carrera, resol.carr and 
modalidad.carrera are REFERENCED to.

When I try to execute a query like this:

DELETE FROM admin_view WHERE id_curso=2;

I get a lost connection and this on the log:

2001-08-07 19:08:40 DEBUG:  ProcessQuery
2001-08-07 19:08:40 DEBUG:  CommitTransactionCommand
2001-08-07 19:08:43 DEBUG:  StartTransactionCommand
2001-08-07 19:08:43 DEBUG:  query: DELETE FROM admin_view WHERE id_curso=2;
XLogFlush: rqst 0/0; wrt 0/62940168; flsh 0/62940168
XLogFlush: rqst 0/57764568; wrt 0/62940168; flsh 0/62940168
2001-08-07 19:08:44 DEBUG:  ProcessQuery
INSERT @ 0/62940168: prev 0/62940128; xprev 0/0; xid 21593; bkpb 1: Heap - 
delete: node 290095/290371; tid 0/2
/usr/local/pgsql/bin/postmaster: reaping dead processes...
/usr/local/pgsql/bin/postmaster: CleanupProc: pid 12353 exited with status 138
Server process (pid 12353) exited with status 138 at Tue Aug  7 19:08:45 2001
Terminating any active server processes...
Server processes were terminated at Tue Aug  7 19:08:45 2001
Reinitializing shared memory and semaphores
invoking IpcMemoryCreate(size=1245184)
2001-08-07 19:08:45 DEBUG:  database system was interrupted at 2001-08-07 
19:08:13 GMT
2001-08-07 19:08:45 DEBUG:  CheckPoint record at (0, 62658256)
2001-08-07 19:08:45 DEBUG:  Redo record at (0, 62610224); Undo record at (0, 
0); Shutdown FALSE
2001-08-07 19:08:45 DEBUG:  NextTransactionId: 21527; NextOid: 313116
2001-08-07 19:08:45 DEBUG:  database system was not properly shut down; 
automatic recovery in progress...
/usr/local/pgsql/bin/postmaster: ServerLoop:            handling reading 6
/usr/local/pgsql/bin/postmaster: ServerLoop:            handling reading 6
/usr/local/pgsql/bin/postmaster: ServerLoop:            handling reading 6
/usr/local/pgsql/bin/postmaster: ServerLoop:            handling reading 6
The Data Base System is starting up
/usr/local/pgsql/bin/postmaster: ServerLoop:            handling writing 62

And after that tns of REDOs (which I guess are OK). Does that ServerLoop 
belong to REDO or is it part of my problem?

Any ideas?

-- 
Cualquiera administra un NT.
Ese es el problema, que cualquiera administre.
-----------------------------------------------------------------
Martin Marques                  |        mmarques@unl.edu.ar
Programador, Administrador      |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: loop on a rule
@ 2001-08-07 23:53  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Martín Marqués <martin@bugs.unl.edu.ar>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2001-08-07 23:53 UTC (permalink / raw)
  To: Martín Marqués <martin@bugs.unl.edu.ar>; +Cc: pgsql-sql

=?iso-8859-1?q?Mart=EDn=20Marqu=E9s?= <martin@bugs.unl.edu.ar> writes:
> As I said before, I am playing around with views and rules, and found out 
> that I have something wrong in one of the rules. My delete rule says 
> something like this:

> CREATE RULE admin_delete AS ON
> DELETE TO admin_view
> DO INSTEAD (
>    DELETE FROM carrera WHERE id_curso=old.id_curso;
>    DELETE FROM inscripcion WHERE carrera=old.id_curso;
>    DELETE FROM resol WHERE carr=old.id_curso;
>    DELETE FROM modalidad WHERE carrera=old.id_curso;
>    INSERT INTO log_carrera (accion,tabla) VALUES ('D','carrera');
> );

I think you need the patch for multi-action rules --- see
http://www.ca.postgresql.org/cgi/cvsweb.cgi/pgsql/src/backend/rewrite/rewriteHandler.c
You need version 1.93.2.1, assuming that you're on PG 7.1.2.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: loop on a rule
@ 2001-08-08 00:09  Martín Marqués <martin@bugs.unl.edu.ar>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Martín Marqués @ 2001-08-08 00:09 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

On Mar 07 Ago 2001 20:53, you wrote:
> =?iso-8859-1?q?Mart=EDn=20Marqu=E9s?= <martin@bugs.unl.edu.ar> writes:
> > As I said before, I am playing around with views and rules, and found out
> > that I have something wrong in one of the rules. My delete rule says
> > something like this:
> >
> > CREATE RULE admin_delete AS ON
> > DELETE TO admin_view
> > DO INSTEAD (
> >    DELETE FROM carrera WHERE id_curso=old.id_curso;
> >    DELETE FROM inscripcion WHERE carrera=old.id_curso;
> >    DELETE FROM resol WHERE carr=old.id_curso;
> >    DELETE FROM modalidad WHERE carrera=old.id_curso;
> >    INSERT INTO log_carrera (accion,tabla) VALUES ('D','carrera');
> > );
>
> I think you need the patch for multi-action rules --- see
> http://www.ca.postgresql.org/cgi/cvsweb.cgi/pgsql/src/backend/rewrite/rewri
>teHandler.c You need version 1.93.2.1, assuming that you're on PG 7.1.2.

Yes, I'm on PostgreSQL 7.1.2. I have a resently updated cvs of pgsql (about 3 
hours old), but I don't want to put the cvs version on my stable server (I 
use it on my WorkStation only).

How can I patch the source of my pgsql 7.1.2 src tree? Any docs are welcomed!

Saludos..... and tons of thanks.... :-)

-- 
Cualquiera administra un NT.
Ese es el problema, que cualquiera administre.
-----------------------------------------------------------------
Martin Marques                  |        mmarques@unl.edu.ar
Programador, Administrador      |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-08-08 00:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-08-07 22:22 loop on a rule Martín Marqués <martin@bugs.unl.edu.ar>
2001-08-07 23:53 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-08-08 00:09   ` Martín Marqués <martin@bugs.unl.edu.ar>

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