Re: [GENERAL] Trigger.. AFTER and BEFORE with specific column changed

2012-04-02 Thread Tom Lane
Albert writes: > *i get:* > Syntax error at or near 'WHEN' > LINE 1: ... check_update AFTER UPDATE ON accounts FOR EACH ROW WHEN > (OLD.balance IS DISTINCT FROM NEW.balance) Does the BEFORE case work for you either? I'm suspicious that you are using a PG version that predates WHEN-clause su

Re: [GENERAL] Trigger.. AFTER and BEFORE with specific column changed

2012-04-02 Thread Adrian Klaver
On 04/01/2012 10:10 PM, Albert wrote: *i get:* Syntax error at or near 'WHEN' LINE 1: ... check_update AFTER UPDATE ON accounts FOR EACH ROW WHEN (OLD.balance IS DISTINCT FROM NEW.balance) Hmmm. So two questions: What happens if you copy the example in the docs exactly and use NEW.* and

Re: [GENERAL] Trigger.. AFTER and BEFORE with specific column changed

2012-04-01 Thread Albert
*i get:* Syntax error at or near 'WHEN' LINE 1: ... check_update AFTER UPDATE ON accounts FOR EACH ROW WHEN (OLD.balance IS DISTINCT FROM NEW.balance) -- View this message in context: http://postgresql.1045698.n5.nabble.com/Trigger-AFTER-and-BEFORE-with-specific-column-changed-tp5610712p561

Re: [GENERAL] Trigger.. AFTER and BEFORE with specific column changed

2012-04-01 Thread Adrian Klaver
On 04/01/2012 11:45 AM, Albert wrote: *I'm trying to follow this :* CREATE TRIGGER check_update *BEFORE* UPDATE ON accounts FOR EACH ROW WHEN (OLD.balance IS DISTINCT FROM NEW.balance) EXECUTE PROCEDURE check_account_update(); *but with AFTER instead of BEFORE. and I'm keep

[GENERAL] Trigger.. AFTER and BEFORE with specific column changed

2012-04-01 Thread Albert
*I'm trying to follow this :* CREATE TRIGGER check_update *BEFORE* UPDATE ON accounts FOR EACH ROW WHEN (OLD.balance IS DISTINCT FROM NEW.balance) EXECUTE PROCEDURE check_account_update(); *but with AFTER instead of BEFORE. and I'm keep getting error on or near WHEN. does that be