Re: Problems with NEW.* in triggers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Problems with NEW.* in triggers
Дата
Msg-id 26587.1067986114@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Problems with NEW.* in triggers  (Jamie Lawrence <postgres@jal.org>)
Ответы Re: Problems with NEW.* in triggers
Список pgsql-sql
Jamie Lawrence <postgres@jal.org> writes:
> I had thought that if moddate isn't included in an insert or update,
> that it would be null in the NEW context,

No, it would be whatever the value to be assigned to the column would
be, if the trigger were not present.  In particular, during an UPDATE
it's going to contain the old value of the field.  In an INSERT it would
be whatever the column's default value is.

I am not sure what your intention is here.  If you want the trigger to
force the field to current time, it can certainly do that.  If you want
the user to control whether the field is updated, why do you need a
trigger at all?
        regards, tom lane


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

Предыдущее
От: Jamie Lawrence
Дата:
Сообщение: Problems with NEW.* in triggers
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Problems with NEW.* in triggers