Re: Empty Updates, ON UPDATE triggers and Rules

Поиск
Список
Период
Сортировка
Искать
От
Jeff Davis
Тема
Re: Empty Updates, ON UPDATE triggers and Rules
Дата
Msg-id
1249579043.9256.751.camel@jdavis
Ответ на
Список
Дерево обсуждения
Empty Updates, ON UPDATE triggers and Rules Josh Trutwin <josh@trutwins.homeip.net>
Re: Empty Updates, ON UPDATE triggers and Rules Jeff Davis <pgsql@j-davis.com>
Re: Empty Updates, ON UPDATE triggers and Rules Merlin Moncure <mmoncure@gmail.com>
Re: Empty Updates, ON UPDATE triggers and Rules Jeff Davis <pgsql@j-davis.com>
Re: Empty Updates, ON UPDATE triggers and Rules Pavel Stehule <pavel.stehule@gmail.com>
Re: Empty Updates, ON UPDATE triggers and Rules Merlin Moncure <mmoncure@gmail.com>
Re: Empty Updates, ON UPDATE triggers and Rules Josh Trutwin <josh@trutwins.homeip.net>
Re: Empty Updates, ON UPDATE triggers and Rules Josh Trutwin <josh@trutwins.homeip.net>
Re: Empty Updates, ON UPDATE triggers and Rules Michael Glaesemann <grzm@seespotcode.net>
Re: Empty Updates, ON UPDATE triggers and Rules Josh Trutwin <josh@trutwins.homeip.net>
Re: Empty Updates, ON UPDATE triggers and Rules Merlin Moncure <mmoncure@gmail.com>
On Thu, 2009-08-06 at 11:53 -0500, Josh Trutwin wrote:
> The set_last_modified() trigger is run even though the data didn't
> actually change.  Perhaps due to an application program which doesn't
> know the contents before running the UPDATE.

The following doc explains the standard way to accomplish this:

http://www.postgresql.org/docs/8.4/static/functions-trigger.html

The document says that in most cases, you would want the above trigger
to fire last. However, I think your situation is different: you probably
want that trigger to fire before your "last updated" trigger.

Rules happen at a much earlier stage. Expressions haven't been evaluated
yet and triggers haven't been fired, etc., so the rule won't really know
whether the new row and old row are really equal or not. A rule will
only work in simple cases, which may or may not be acceptable for you.

Regards,
	Jeff Davis

В списке pgsql-general по дате отправления
От: Merlin Moncure
Дата:
От: decibel
Дата:
FAQ