pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerardo Herzig <gherzig@fmed.uba.ar>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Chris Browne <cbbrowne@acm.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: trigger for TRUNCATE?
Date: Thu, 10 Jan 2008 15:12:10 -0300
Message-ID: <47865FFA.6060008@fmed.uba.ar> (raw)
In-Reply-To: <8003.1199986734@sss.pgh.pa.us>
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>

Tom Lane wrote:

>Alvaro Herrera <alvherre@commandprompt.com> writes:
>  
>
>>Gerardo Herzig escribió:
>>    
>>
>>>Yes, the TRUNCATE statement is not sql ansi, maybe is a more low level 
>>>thing than i think.
>>>      
>>>
>
>  
>
>>TRUNCATE currently does not fire triggers, but that doesn't mean it's
>>impossible to do it.  I think it would be fairly easy to add support
>>for that.
>>    
>>
>
>The entire point of TRUNCATE is to not do a table scan, so making it
>fire per-row triggers seems pretty misguided to me.
>
>We could maybe make it fire per-statement ON DELETE triggers, but
>there's a future-proofing pitfall in that: someday it'd be nice
>for statement-level triggers to have access to the set of deleted rows,
>and then you'd be stuck either scanning the table or having TRUNCATE
>act differently from plain DELETE.
>
>My feeling is that if you want to know what was deleted, you shouldn't
>use TRUNCATE.
>
>			regards, tom lane
>
>  
>
I 100% agree, i can live using delete instead, but i can't ensure the 
whole team i work with will not use TRUNCATE. It was my bad naming the 
thread with such a contradictory name, im just looking the way to 
capture it in any form. I would even consider the posibility of 
*ignoring* a TRUNCATE command, if thats possible.

Thanks you all, dudes!
Gerardo




view thread (16+ messages)  latest in thread

Message-ID: <47865FFA.6060008@fmed.uba.ar>
Permalink:  ../47865FFA.6060008@fmed.uba.ar/
Also on:    postgresql.org/message-id/47865FFA.6060008@fmed.uba.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gherzig@fmed.uba.ar, tgl@sss.pgh.pa.us, alvherre@commandprompt.com, pavel.stehule@gmail.com, cbbrowne@acm.org
  Subject: Re: trigger for TRUNCATE?
  In-Reply-To: <47865FFA.6060008@fmed.uba.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox