Skip site navigation (1) Skip section navigation (2)

Re: trigger for TRUNCATE?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gerardo Herzig <gherzig(at)fmed(dot)uba(dot)ar>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Chris Browne <cbbrowne(at)acm(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: trigger for TRUNCATE?
Date: 2008-01-10 17:47:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Tom Lane escribió:
> Alvaro Herrera <alvherre(at)commandprompt(dot)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.

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

Alvaro Herrera                      
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to


pgsql-sql by date

Next:From: Gerardo HerzigDate: 2008-01-10 18:12:10
Subject: Re: trigger for TRUNCATE?
Previous:From: Tom LaneDate: 2008-01-10 17:38:54
Subject: Re: trigger for TRUNCATE?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group