Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id C4B892E25E8 for ; Thu, 10 Jan 2008 15:53:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 81792-09 for ; Thu, 10 Jan 2008 15:52:58 -0400 (AST) Received: from outmail129147.authsmtp.net (outmail129147.authsmtp.net [62.13.129.147]) by postgresql.org (Postfix) with ESMTP id E2B0E2E0364 for ; Thu, 10 Jan 2008 15:53:11 -0400 (AST) Received: from outmail128178.authsmtp.net (outmail128178.authsmtp.net [62.13.128.178]) by punt2.authsmtp.com (8.13.8/8.13.8/Kp) with ESMTP id m0AJrAnE029116 for ; Thu, 10 Jan 2008 19:53:10 GMT Received: from [192.168.0.3] (81-6-228-215.dyn.gotadsl.co.uk [81.6.228.215]) (authenticated bits=0) by mail.authsmtp.com (8.13.8/8.13.8/Kp) with ESMTP id m0AJr9G6038633 for ; Thu, 10 Jan 2008 19:53:10 GMT Subject: Re: trigger for TRUNCATE? From: Simon Riggs To: pgsql-sql@postgresql.org Content-Type: text/plain Date: Thu, 10 Jan 2008 19:53:44 +0000 Message-Id: <1199994824.4266.851.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2 Content-Transfer-Encoding: 7bit X-Server-Quench: abaec14c-bfb5-11dc-9554-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MOFUSTAAU KV9eBkJUK0ETX1xC QjoVBBYDHlxxRhkk NRVTbQVVcktHVQBp WklJDFpTCgN2Ax4J GBwfVwZwchpGNiNw FDwgVwddXEdyc0V+ DE9XFGpINDUxPTMe VBNFJVUGdR5Lf0sW d1l6UXcQYWUGZ3Jl E1RsYDs4Kw9SemxJ WAACIl8ICUgMBHYA fS0kNhwTMBpt X-Authentic-SMTP: 61633235383639.squirrel.dmpriest.net.uk:787/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/74 X-Sequence-Number: 29927 Alvaro Herrera wrote: > My thinking is that a TRUNCATE trigger is a per-statement trigger which > doesn't have access to the set of deleted rows. > In that way it would be different from a per-statement trigger for > DELETE. Completely agree. A truncate trigger should run a different function to a delete trigger. This is an important feature for trigger-based replication systems. Not just slony, but bucardo and others too. It's an embarrassing hole in our high availability capabilities and we really need to fill the gap. We can't always control whether an application will issue truncates or not. Rather spookily that's what I've been working on this afternoon, though I didn't realise this thread was in progress until now, nor did I realise there might be possible objections. I do hope the importance of it is enough to overcome objections. Yes, it does look fairly straightforward. Should be ready for when 8.4 opens, assuming we agree. -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com