Re: BEFORE UPDATE Triggers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BEFORE UPDATE Triggers
Дата
Msg-id 2691.1062280587@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BEFORE UPDATE Triggers  (Jan Wieck <jan@black-lion.info>)
Ответы Re: BEFORE UPDATE Triggers
Список pgsql-sql
Jan Wieck <jan@black-lion.info> writes:
> Unfortunately, you're right. There is no way do distinguish in a trigger 
> or rule if a value in the new row did result from the UPDATE query or 
> from target list expansion with OLD values.

> It would not be terribly hard to examine the original query during 
> executor start, looking for bare OLD referencing Var nodes, and stick 
> something like a flag array into the trigger information.

People keep suggesting this, but I've never thought it was a very sane
idea.  What if some BEFORE trigger upstream of yours changes the column?
You won't find that out unless you actually compare the OLD and NEW
column values.  If you assume the column has not changed just because
the original query text didn't change it, you are in for a world of hurt.
        regards, tom lane


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Getting the return type right for SETOF
Следующее
От: "Dan Langille"
Дата:
Сообщение: Re: Getting the return type right for SETOF