Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 35F421337BCE for ; Tue, 8 Feb 2011 21:30:44 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 92830-06 for ; Wed, 9 Feb 2011 01:30:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from nm5-vm1.bullet.mail.ukl.yahoo.com (nm5-vm1.bullet.mail.ukl.yahoo.com [217.146.183.233]) by mail.postgresql.org (Postfix) with SMTP id 323131337B5E for ; Tue, 8 Feb 2011 21:30:36 -0400 (AST) Received: from [217.146.183.180] by nm5.bullet.mail.ukl.yahoo.com with NNFMP; 09 Feb 2011 01:30:36 -0000 Received: from [217.146.183.163] by tm11.bullet.mail.ukl.yahoo.com with NNFMP; 09 Feb 2011 01:30:36 -0000 Received: from [127.0.0.1] by omp1004.mail.ukl.yahoo.com with NNFMP; 09 Feb 2011 01:30:36 -0000 X-Yahoo-Newman-Property: ymail-5 X-Yahoo-Newman-Id: 200562.66952.bm@omp1004.mail.ukl.yahoo.com Received: (qmail 16197 invoked by uid 60001); 9 Feb 2011 01:30:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.it; s=s1024; t=1297215036; bh=UhiKqS9Ec1Ng3CnfJoRi5dGpH9t7WwbWKibv51QjFxk=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=yw9XJdIQ4ajEPC6yGd9JNX7KNL+BzF4dOa4k1tRKQ4CXQyf1olw5VXOCpkztdA7WAA6rsNlLEw6lbqeqQwhYTbl+QZF6yvvd9NGJ5b0fbHCW8bTSeVr2Z3Az9Z7CWRj/YXIFttiGtxhnMT2WejA9UWFD8abzbrDQL30b4hAFvzw= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.it; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=jPBoU4ad8Kn6Hnh7cI9a6dtOiIJ34iDZiXcZZz2Zb2xSCPMCRPbGxwZ52XZT+qJ5nWMCbjTmjxdfGnHjselrWhenZW4sKH/wJxLV+LMyG2N7h9X/lQjQzoR2Ku6z0RhntCSR73AbjPtcxNzJI9PTlcA5WD5X3j/5JG+gVT5JeEQ=; Message-ID: <89587.12999.qm@web25603.mail.ukl.yahoo.com> X-YMail-OSG: fwG8KCkVM1kuVaxjY594m0mV36qWs3R.QIVj8R3x_sj.vor .h4yF4c7IP058wajPc3RQnP_eBDgZtrNSTYTxBSM1W1sP8baF7RMJ0NKK302 DvHg0Rebd7J4AG9frwfyYhhS0pUk8jPUOf.dUav6djMhPgn6U6h_IAUHe7IP 9REuwd2xii7D4O1cC1RFcI99qhSjoYBJgD6wncfv3lEirofgqJe6gLuBnCiA Zh01KAIrV1WDuuVDxTwgZhDzMymg4y91qIWrmXxcfLm9MtTrqA_9A.8xnylY azJYqqwN7 Received: from [2.38.133.131] by web25603.mail.ukl.yahoo.com via HTTP; Wed, 09 Feb 2011 01:30:35 GMT X-Mailer: YahooMailRC/555 YahooMailWebService/0.8.108.291010 Date: Wed, 9 Feb 2011 01:30:35 +0000 (GMT) From: Ludovico Bonifacio Subject: TRigger catch delete on cascade from different table To: pgsql-students@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1350539929-1297215035=:12999" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.906 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_FONT_FACE_BAD=0.981, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RFC_ABUSE_POST=0.001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201102/2 X-Sequence-Number: 140 --0-1350539929-1297215035=:12999 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable hi everybody!=0ACould you help me please?=0AHow do i do to active a trigge= r (target is save the history from delete rows) =0Awithout catch the event = from the table where has created =0Abut catching the delete effect from a r= eferenced value of other table? =0A=0AFor example=0A=0ACREATE TABLEDocument= =0A(=0Aid_document INTEGER PRIMARY KEY,=0Aid_user INTEGER REFERENCES User(i= d_user) =0AON UPDATE CASCADE=0AON DELETE CASCADE=0A);=0A=0A=0ACREATE TABLEU= ser=0A(=0Aid_user INTEGER PRIMARY KEY,=0Ausername VARCHAR(20) NOT NULL,=0Ap= wd VARCHAR(30) NOT NULL,=0Aemail VARCHAR(30) NOT NULL=0A);=0A=0A=0AOn Docum= ent table i defined a trigger =0AAFTER DELETE ON Document=0A=0AOn User tabl= e i excute =0ADELETE FROM User WHERE(condition); =0A =0ASo, when i delete a= user from User table, the trigger rightly doesn't recognise =0Athe DELETE = because the recognise on Document.=0A=0AExists a way that let understand/ca= tching at Trigger activing also in the case =0Aof deleting on cascade from = other table?=0A=0AThanks in advanced=0AGreating=0A=0A=0A=0A --0-1350539929-1297215035=:12999 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
hi = everybody!
How do i do to=0A active a trigger (target is save the histo= ry from delete rows) without catch the event from the table where has created 
but catching the dele= te effect from a referen= ced value of other table? 

For example

<= div style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:= 0px;">CREATE TABLE Docum= ent
=09(
=09id_document INTEGER PRIMARY KEY,
=09id_user&nbs= p;INTEGER REFERENCES User(id_user) 
=09ON UPDATE CASCADE
=09ON DELETE CASCADE
=0A=09);


CREAT= E TABLE User
=09(
<= div style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px= ;font-family:tahoma, times, serif;color:rgb(0, 0, 0);">=09id_user INTEGER PRIMARY KEY= ,
=09username = VARCHAR(20) NOT NULL,
=0A=09pwd VARCHAR(30) NOT NULL,
=09email VARCHAR(30) NOT NULL<= /div>
=09);


On D= ocument table i defined a trigger&n= bsp;
AFTER DELETE ON Document
<= div style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-le= ft: 0px; color: rgb(0, 0, 0); font-family: tahoma, times, serif; ">
On User table i excute 
DELETE FROM User WHERE(condition); 
 
So, when i delete a user from Use= r table, the trigger rightly doesn't recognise the DELETE because the recog= nise on Document.

Exists a way that let understand/catching at Trigg= er activing also in the case of deleting on cascade from other table?
=
Thanks in advanced
Greating
=0A=0A=0A

=0A=0A=0A=0A=
=0A=0A=0A

=0A=0A=0A=0A --0-1350539929-1297215035=:12999--