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: Rule ON DELETE, to perform to DELETE querys !
Date: Fri, 08 Jun 2001 16:28:36 +0100
Message-ID: <3B20EF24.7EE0CD77@ualg.pt> (raw)

I have a view over a join of tables and when it's performed over the
view a delete i want to delete records in two different tables. The code
that i wrote was:

    CREATE RULE "deletetables" AS ON DELETE TO "tables"
         DO INSTEAD (
         DELETE FROM table2
                WHERE id = OLD.id;
         DELETE FROM table1
                WHERE id=OLD.id
           );

table2 references table1 by the field id only for update. I don't them
to be referenced by delete !

When i execute: DELETE FROM tables WHERE id=1; i got these message from
postgres:

pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

The records exists in both tables !!!!!!!

This already happen with some of you ???? How can i do this ????


Thanks

Luis Sousa



view thread (2+ messages)

Message-ID: <3B20EF24.7EE0CD77@ualg.pt>
Permalink:  ../3B20EF24.7EE0CD77@ualg.pt/
Also on:    postgresql.org/message-id/3B20EF24.7EE0CD77@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: Rule ON DELETE, to perform to DELETE querys !
  In-Reply-To: <3B20EF24.7EE0CD77@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