Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id BE0E82E2DCA for ; Tue, 8 Jan 2008 17:22:16 -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 94945-09 for ; Tue, 8 Jan 2008 17:22:16 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id 2ADDE2E02DD for ; Tue, 8 Jan 2008 17:22:16 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.1/8.14.1) with ESMTP id m08LM7GS065189 for ; Tue, 8 Jan 2008 17:22:07 -0400 (AST) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.1/8.14.1/Submit) id m08L3src059785 for pgsql-sql@postgresql.org; Tue, 8 Jan 2008 17:03:54 -0400 (AST) (envelope-from news) From: Chris Browne X-Newsgroups: pgsql.sql Subject: Re: trigger for TRUNCATE? Date: Tue, 08 Jan 2008 15:57:21 -0500 Organization: cbbrowne Computing Inc Lines: 29 Message-ID: <60tzloyr0u.fsf@dba2.int.libertyrms.com> References: <4783BEA9.3020507@fmed.uba.ar> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.21 (linux) Cancel-Lock: sha1:PlhkCi15QF/U02mKRE2qp31s3fM= To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/54 X-Sequence-Number: 29907 gherzig@fmed.uba.ar (Gerardo Herzig) writes: > Hi all. Acording to the docs, TRUNCATE will not fire a DELETE trigger > on the table being truncated. > There is a way to capture a TRUNCATE in any way? I think there's some sort of "to do" on that... It ought to be not *too* difficult (I imagine!) to be able to associate a trigger with the TRUNCATE action, and therefore run some stored function any time TRUNCATE takes place. For the Slony-I replication system, it would be attractive for this to lead to attaching two functions: - One function would return an exception so that TRUNCATE against a subscriber node would fail... - Another would pretty much be as simple as submitting an event; perform createEvent('_ourcluster', 'TRUNCATE_TABLE', table_id); A new event, TRUNCATE_TABLE, would do a TRUNCATE against the subscribers. This represents a pretty easy enhancement, given the new kind of trigger. -- (reverse (concatenate 'string "moc.enworbbc" "@" "enworbbc")) http://www3.sympatico.ca/cbbrowne/nonrdbms.html Frisbeetarianism: The belief that when you die, your soul goes up on the roof and gets stuck...