Re: Triggers on columns - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: Triggers on columns
Date
Msg-id 4A9F9039020000250002AA1C@gw.wicourts.gov
Whole thread Raw
In response to Re: Triggers on columns  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.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


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Triggers on columns
Next
From: Dimitri Fontaine
Date:
Subject: Re: Triggers on columns