Re: BEFORE UPDATE trigger doesn't change column value - Mailing list pgsql-general

From Clemens Eisserer
Subject Re: BEFORE UPDATE trigger doesn't change column value
Date
Msg-id CAFvQSYRxVBms3e7G2KjCA2qsQeJtASOvgfaJOOr4=vDzUPkW2g@mail.gmail.com
Whole thread Raw
In response to Re: BEFORE UPDATE trigger doesn't change column value  (Kevin Grittner <kgrittn@ymail.com>)
Responses Re: BEFORE UPDATE trigger doesn't change column value
List pgsql-general
Hi,

NEW reflects what the row will look like after the UPDATE.  There
is no way to tell which columns were specified in the SET clause of
the UPDATE; a column which is omitted from that clause will look
exactly the same as a column which is set to the value it already
had.

Thanks a lot for clarifying this ... my logic was flawed.
At stackoverflow.com I found an example which suggested testing against NULL would allow this and I just relied on it.

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?

Regards, Clemens


pgsql-general by date:

Previous
From: Gavan Schneider
Date:
Subject: Re: BEFORE UPDATE trigger doesn't change column value
Next
From: Pete Wall
Date:
Subject: PostgreSQL Downgrades