pg.ddx.io  pgsql-students@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ludovico Bonifacio <ludoedgar@yahoo.it>
To: pgsql-students@postgresql.org
Subject: TRigger catch delete on cascade from different table
Date: Wed, 9 Feb 2011 01:30:35 +0000 (GMT)
Message-ID: <89587.12999.qm@web25603.mail.ukl.yahoo.com> (raw)

hi everybody!
Could you help me please?
How do i do to  active a trigger (target is save the history from delete rows) 
without catch the event from the table where has created 
but catching the delete effect from a referenced value of other table? 

For example

CREATE TABLEDocument
(
id_document INTEGER PRIMARY KEY,
id_user INTEGER REFERENCES User(id_user) 
ON UPDATE CASCADE
ON DELETE CASCADE
);


CREATE TABLEUser
(
id_user INTEGER PRIMARY KEY,
username VARCHAR(20) NOT NULL,
pwd VARCHAR(30) NOT NULL,
email VARCHAR(30) NOT NULL
);


On Document table i defined a trigger 
AFTER DELETE ON Document

On User table i excute 
DELETE FROM User WHERE(condition); 
 
So, when i delete a user from User table, the trigger rightly doesn't recognise 
the DELETE because the recognise on Document.

Exists a way that let understand/catching at Trigger activing also in the case 
of deleting on cascade from other table?

Thanks in advanced
Greating



      

Message-ID: <89587.12999.qm@web25603.mail.ukl.yahoo.com>
Permalink:  ../89587.12999.qm@web25603.mail.ukl.yahoo.com/
Also on:    postgresql.org/message-id/89587.12999.qm@web25603.mail.ukl.yahoo.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-students@postgresql.org
  Cc: ludoedgar@yahoo.it
  Subject: Re: TRigger catch delete on cascade from different table
  In-Reply-To: <89587.12999.qm@web25603.mail.ukl.yahoo.com>
  References: <89587.12999.qm@web25603.mail.ukl.yahoo.com>

* 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