Re: knowing which columns have beend UPDATEd inside a TRIGGER?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: knowing which columns have beend UPDATEd inside a TRIGGER?
Дата
Msg-id 26414.972427863@sss.pgh.pa.us
обсуждение исходный текст
Ответ на knowing which columns have beend UPDATEd inside a TRIGGER?  (Louis-David Mitterrand <cunctator@apartia.ch>)
Ответы Re: knowing which columns have beend UPDATEd inside a TRIGGER?  (Louis-David Mitterrand <cunctator@apartia.ch>)
Список pgsql-sql
Louis-David Mitterrand <cunctator@apartia.ch> writes:
> Is there a way to know which columns are being UPDATEd or INSERTEd from
> inside a trigger, either in C or pl/pgsql?

Huh?  An INSERT always inserts all columns, by definition.  Some of them
might be null and/or equal to their default values, but they're all
there.

For an UPDATE, you could check to see whether old.col = new.col.
This would miss the case where an UPDATE command is explicitly setting
a column to the same value it already had; dunno if you care or not.
        regards, tom lane


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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Help on Union Query
Следующее
От: Carolyn Lu Wong
Дата:
Сообщение: quote in function