Re: [GENERAL] BEFORE UPDATE trigger doesn't change column value

2013-04-07 Thread Clemens Eisserer
Hi Kevin, Sorry, that's the wrong way around. I should have said: > > Your BEFORE UPDATE trigger could leave the "synced" value in NEW > alone if force_sync was **true**, and set "synced" to false > otherwise. It could then set NEW.force_sync to false, to leave you > ready for the next update. >

Re: [GENERAL] BEFORE UPDATE trigger doesn't change column value

2013-04-06 Thread Kevin Grittner
Kevin Grittner wrote: > 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. Sorry, that's the wrong way around.  I should hav

Re: [GENERAL] BEFORE UPDATE trigger doesn't change column value

2013-04-06 Thread Kevin Grittner
Clemens Eisserer 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 ther

Re: [GENERAL] BEFORE UPDATE trigger doesn't change column value

2013-04-05 Thread Clemens Eisserer
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

Re: [GENERAL] BEFORE UPDATE trigger doesn't change column value

2013-04-05 Thread Gavan Schneider
On 5/4/13 at 6:59 AM, Clemens Eisserer wrote: Sorry for this newbie-question, I am trying for quite some time now to get the following trigger-function to work properly: CREATE OR REPLACE FUNCTION update_synced_column() RETURNS trigger AS $BODY$ BEGIN IF NEW.synced IS NULL THEN NEW.synced := f

Re: [GENERAL] BEFORE UPDATE trigger doesn't change column value

2013-04-05 Thread Kevin Grittner
Clemens Eisserer wrote: > I am trying for quite some time now to get the following > trigger-function to work properly: > > CREATE OR REPLACE FUNCTION update_synced_column() >   RETURNS trigger AS > $BODY$ > BEGIN >    IF NEW.synced IS NULL THEN > NEW.synced :=  false; >    END IF; >    RETU

[GENERAL] BEFORE UPDATE trigger doesn't change column value

2013-04-05 Thread Clemens Eisserer
Hi, Sorry for this newbie-question, I am trying for quite some time now to get the following trigger-function to work properly: CREATE OR REPLACE FUNCTION update_synced_column() RETURNS trigger AS $BODY$ BEGIN IF NEW.synced IS NULL THEN NEW.synced := false; END IF; RETURN NEW; END