Re: BEFORE UPDATE trigger doesn't change column value
От | Kevin Grittner |
---|---|
Тема | Re: BEFORE UPDATE trigger doesn't change column value |
Дата | |
Msg-id | 1365256326.76058.YahooMailNeo@web162905.mail.bf1.yahoo.com обсуждение исходный текст |
Ответ на | Re: BEFORE UPDATE trigger doesn't change column value (Clemens Eisserer <linuxhippy@gmail.com>) |
Ответы |
Re: BEFORE UPDATE trigger doesn't change column value
|
Список | pgsql-general |
Clemens Eisserer <linuxhippy@gmail.com> wrote: > Here is what I am trying to achieve: Set "synced" to false at any > update, except when it has been set explicitly to true. > This does not seem to be possible, without checking the value SET > by UPDATE? Right; since there is no way to check whether a 'true' value there was explicitly set or just carrying over from the old version of the row without being set, you need some other mechanism for handling this. You could, for exampe, add a "force_sync" column which could be tested in a trigger. Your BEFORE UPDATE trigger could leave the "synced" value in NEW alone if force_sync was false, and set "synced" to false otherwise. It could then set NEW.force_sync to false, to leave you ready for the next update. -- Kevin Grittner EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-general по дате отправления: