From: fluca1978@infinito.it
To: pgsql-it-generale@postgresql.org
Subject: Re: trigger on delete cascade
Date: Sun, 20 Feb 2011 15:42:01 +0100
Message-ID: <201102201542.02101.fluca1978@infinito.it> (raw)
In-Reply-To: <447805.9668.qm@web25602.mail.ukl.yahoo.com>
References: <447805.9668.qm@web25602.mail.ukl.yahoo.com>
MI viene da dire che quello che potrebbe fare al caso tuo sia una regola su
Documento che scatti al DELETE e che esegua INSTEAD la delete cascade e una
stored procedure (la stessa che avresti usato per il trigger).
Luca
On Wednesday, February 09, 2011 02:31:29 AM Ludovico Bonifacio's cat walking
on the keyboard wrote:
> Ciao a tutti!
> Esiste un modo per attivare un trigger(il cui scopo è di salvare ciò che
> si elimina)
> non su un evento sulla tabella per cui è stato creato ma per effetto di
> una cancellazione di un valore riferito in un altra tabella??
> Ad esempio ho:
> il trigger che si attiva
> AFTER DELETE ON Documento
>
> e in Utente ho
> id_utente ON DELETE CASCADE
>
> quindi appena cancello un utente da Utente, giustamente il trigger non
> riconosce la DELETE perchè la rileva su Documento.
> Esiste un modo per fargli rilevare al Trigger di attivarsi anche nel caso
> di eliminazioni on cascade da altre tabelle(in modo da salvare nella
> tabella archivio ciò che viene eliminato da Documento)?
> Se si quale?
> Se no, come potrei fare?
>
> Nello specifico le tabelle sono così:
> CREATE TABLE Documento
> (
> id_documento INTEGER PRIMARY KEY,
> id_utente INTEGER REFERENCES Utente(id_utente)
> ON UPDATE CASCADE
> ON DELETE CASCADE);
>
> CREATE TABLEUtente
> (
> id_utente INTEGER PRIMARY KEY;
> );
>
> Grazie in anticipo a tutti
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-it-generale@postgresql.org
Cc: fluca1978@infinito.it
Subject: Re: trigger on delete cascade
In-Reply-To: <201102201542.02101.fluca1978@infinito.it>
* 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