Re: Truncate Triggers

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: Truncate Triggers
Дата
Msg-id 20080202194332.GC4153@fetter.org
обсуждение исходный текст
Ответ на Re: Truncate Triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Truncate Triggers  ("Christopher Browne" <cbbrowne@gmail.com>)
Список pgsql-hackers
On Sat, Feb 02, 2008 at 02:23:40PM -0500, Tom Lane wrote:
> David Fetter <david@fetter.org> writes:
> > On Thu, Jan 31, 2008 at 10:22:42AM +0000, Gregory Stark wrote:
> >> There are plenty of DDL commands which modify data (CREATE INDEX,
> >> ATLER TABLE ALTER COLUMN TYPE). The defining characteristic of DDL
> >> is not that it doesn't modify the data but that it does modify the
> >> table definition.
> 
> > Counter-example: ALTER TABLE ALTER COLUMN USING will almost certainly
> > modify data, but it's DDL nonetheless.
> 
> Uh, how is that a counter-example to what Greg said?

Oops.  I misread.  D'oh.

> I think the real question here is whether there is a defensible
> use-case for a trigger.  In the case of TRUNCATE it's pretty obvious
> what you might want the trigger for: to do the same thing your
> per-row ON DELETE trigger does, but across all rows.  It's much less
> easy to envision a scriptable-in-advance response to arbitrary ALTER
> TABLE operations.
> 
> Looked at in this light, TRUNCATE is clearly more nearly DML than
> DDL, in the sense that its effects are predictable and involve only
> the data not the schema (at least in the user's view).

It still involves DDL-like operations in the sense of changing (for
the duration of the query) trigger behavior.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Florian Weimer
Дата:
Сообщение: Re: configurability of OOM killer
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: configurability of OOM killer