Re: Update Trigger Inconsistency with 7.1?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Update Trigger Inconsistency with 7.1?
Дата
Msg-id 3381.980535531@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Update Trigger Inconsistency with 7.1?  ("Gregory Wood" <gregw@com-stock.com>)
Список pgsql-general
"Gregory Wood" <gregw@com-stock.com> writes:
> To do this I created a trigger that would raise an exception "IF
> new.UpdateRequired ISNULL". In 7.0 this would work because
> new.UpdateRequired seemed to be NULL unless it was specified (I cannot test
> this any longer because I don't have a 7.0 server available).

I find that very hard to believe.  The NEW record contains the proposed
new tuple, which will include the old value of any fields that weren't
specified in the UPDATE statement.

You can detect whether a field is actually being *changed* by comparing
NEW.field and OLD.field.  You cannot distinguish the case where the
UPDATE didn't mention a field from the case where it did but assigned
the same value that was already there (eg UPDATE foo SET x = x).
This behavior was not different in 7.0.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Performance: Unix sockets vs. TCP/IP sockets
Следующее
От: Doug McNaught
Дата:
Сообщение: Re: Performance: Unix sockets vs. TCP/IP sockets