Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id CE3A02E4950 for ; Fri, 11 Jan 2008 04:24:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 31516-09 for ; Fri, 11 Jan 2008 04:24:45 -0400 (AST) Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by postgresql.org (Postfix) with ESMTP id 5BC782E494C for ; Fri, 11 Jan 2008 04:24:45 -0400 (AST) Received: from [84.51.143.99] (helo=server3.office.archonet.com) by pih-relay06.plus.net with esmtp (Exim) id 1JDFBs-0002vD-Ve; Fri, 11 Jan 2008 08:24:37 +0000 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id B60A2274060; Fri, 11 Jan 2008 08:24:35 +0000 (GMT) Message-ID: <478727C3.3090301@archonet.com> Date: Fri, 11 Jan 2008 08:24:35 +0000 From: Richard Huxton User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: Tom Lane CC: Alvaro Herrera , Gerardo Herzig , Pavel Stehule , Chris Browne , pgsql-sql@postgresql.org Subject: Re: trigger for TRUNCATE? References: <4783BEA9.3020507@fmed.uba.ar> <60tzloyr0u.fsf@dba2.int.libertyrms.com> <162867790801081338n237497efpecffaa255253274d@mail.gmail.com> <47864A6B.3070902@fmed.uba.ar> <20080110171027.GK6465@alvh.no-ip.org> <8003.1199986734@sss.pgh.pa.us> <20080110174705.GO6465@alvh.no-ip.org> <9563.1199992524@sss.pgh.pa.us> In-Reply-To: <9563.1199992524@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/87 X-Sequence-Number: 29940 Tom Lane wrote: > Alvaro Herrera writes: >> My thinking is that a TRUNCATE trigger is a per-statement trigger which >> doesn't have access to the set of deleted rows (Replicator uses it that >> way -- we replicate the truncate action, and replay it on the replica). >> In that way it would be different from a per-statement trigger for >> DELETE. > > Ah, right. I was thinking in terms of having TRUNCATE actually fire the > existing ON DELETE-type triggers, but that's not really helpful --- you'd > need a separate trigger-event type. So we could just say by fiat that > an ON TRUNCATE trigger doesn't get any rowset information, even after we > add that for the other types of statement-level triggers. I've always considered TRUNCATE to be DDL rather than DML. I mentally group it with DROP TABLE rather than DELETE> -- Richard Huxton Archonet Ltd