Re: autoupdating mtime column
От | Tom Lane |
---|---|
Тема | Re: autoupdating mtime column |
Дата | |
Msg-id | 29505.1154707823@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: autoupdating mtime column ("David Garamond" <davidgaramond@gmail.com>) |
Ответы |
Re: autoupdating mtime column
|
Список | pgsql-sql |
"David Garamond" <davidgaramond@gmail.com> writes: > On 8/4/06, Richard Huxton <dev@archonet.com> wrote: >> Just check for OLD.mtime = NEW.mtime, or am I missing something here? > How do I differentiate between: > UPDATE t SET mtime=mtime ...; > in which mtime is specifically set and should not change, You don't. A trigger has no way to know the history of the row it's looking at --- consider the possibility that it was already modified by earlier triggers. If you are really intent on having a way to suppress the mtime update you could dedicate an additional field to the purpose, eg UPDATE t SET foo=..., bar=..., keepmtime = true ... and in the trigger something like if new.keepmtime then new.keepmtime = false;else new.mtime = now(); As long as nothing else ever touches keepmtime this would work. Personally I'm dubious that it's worth the trouble --- do you have a real use-case for suppressing mtime updates? regards, tom lane
В списке pgsql-sql по дате отправления: