Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> It also seems to me logically inconsistent that we would expose this
> information via the CREATE TRIGGER interface but not to the trigger
> function itself. From within the function, you can compare NEW and
> OLD, but you get no visibility into which columns were actually
> updated. And apparently now from within CREATE TRIGGER we'll have
> just the opposite. Blech...
Sybase provides an "if update(columnname)" syntax to allow such tests.
Perhaps PostgreSQL could do something similar?
> Sometimes it's useful to schedule a no-op update explicitly for the
> purpose of firing triggers.
Yes. It's a less frequent need, but it does exist. The thing is, if
you only fire triggers if something was actually changed to a new
value, you can't get to that. If you fire on all updates you can test
whether there were actual changes. Of course, ideally, both would be
convenient.
-Kevin