Re: Modification Dates
От | Nigel J. Andrews |
---|---|
Тема | Re: Modification Dates |
Дата | |
Msg-id | Pine.LNX.4.21.0309290103420.31021-100000@ponder.fairway2k.co.uk обсуждение исходный текст |
Ответ на | Modification Dates (Sven Schwyn <zeug@bluewin.ch>) |
Ответы |
Re: Modification Dates
Re: Modification Dates |
Список | pgsql-general |
On Sat, 27 Sep 2003, Sven Schwyn wrote: > Hi > > Many people are asking how to automatically update columns containing a > modification date on updates. I'm wondering if the only solutions in > the current pgsql really are... > > - adding "modification=NOW()" to every update query "manually" > - defining a trigger called on updates > > While addings things "manually" is quite clumsy, a trigger actually > causes a second update thus slowing down the Db. > I suspect you're misunderstanding something about triggers, an on update trigger setting a such a field to the current timestamp shouldn't be causing a second update. You're actually doing an update statement within the trigger I presume? That's not the way, just set NEW.modified to the value you want, eg. the current timestamp. > As far as I know, rules don't help due to circular conditions (an > update causes an update causes an update...) and functions stil require > to add stuff to each and every update. But I could be wrong. Please - > anyone - enlighten me, us and the world :-) Does an update within a rule get rewritten by the rule system if it's on the same table as the rule? Nigel Andrews
В списке pgsql-general по дате отправления: