Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id D050B2E43D2 for ; Tue, 8 Jan 2008 17:42:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 79196-01-3 for ; Tue, 8 Jan 2008 17:42:50 -0400 (AST) Received: from hu-out-0506.google.com (hu-out-0506.google.com [72.14.214.232]) by postgresql.org (Postfix) with ESMTP id 85E932E431D for ; Tue, 8 Jan 2008 17:38:40 -0400 (AST) Received: by hu-out-0506.google.com with SMTP id 22so1337539hug.23 for ; Tue, 08 Jan 2008 13:38:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=cWMsJXrbPvi4DBYL/1UeT7XZ72yHNzZLHP2rMgp1tp4=; b=oG5ybclR42ESBLjTN5jSyv61bB9Tf5b408PBWEeg2y4xG+mxbnc9O273Uybpj8yEOODQOIwVzXx9NNj6nbaLFG4orUV0uk5akzsQGwhXYgTuEnnJQZZMybH7Gl6yWMcogVTEMOg5YR35r+xBYVOVIZrOvTpkxH0cLwQYnwFDVdQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=T97RmZuGqiWNQ724dTA6wZPUrq0qVmKg+o3y7HphJQpQZnT3LU0kZpJ7lt+kIghSZorziQckPk+udlBY1JeevfNo0Ys4+5Lq5XsXqKN1u60b1gRMdaxP7E+t8KuBeNBdk8qw3DAybqbeXyoL3r6KrvhtNOPLoQpU1THfDo788Yc= Received: by 10.78.193.5 with SMTP id q5mr2586653huf.4.1199828317821; Tue, 08 Jan 2008 13:38:37 -0800 (PST) Received: by 10.78.35.6 with HTTP; Tue, 8 Jan 2008 13:38:37 -0800 (PST) Message-ID: <162867790801081338n237497efpecffaa255253274d@mail.gmail.com> Date: Tue, 8 Jan 2008 22:38:37 +0100 From: "Pavel Stehule" To: "Chris Browne" Subject: Re: trigger for TRUNCATE? Cc: pgsql-sql@postgresql.org In-Reply-To: <60tzloyr0u.fsf@dba2.int.libertyrms.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4783BEA9.3020507@fmed.uba.ar> <60tzloyr0u.fsf@dba2.int.libertyrms.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/55 X-Sequence-Number: 29908 Hello theoretically you can have trigger on any statement, but I am not sure about conformance with std. But, you can wrap TRUNCATE statement into some procedure, and then call this procedure with some other actions. Regards Pavel Stehule On 08/01/2008, Chris Browne wrote: > 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... > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq >