From: | Clemens Eisserer <linuxhippy(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | BEFORE UPDATE trigger doesn't change column value |
Date: | 2013-04-05 19:59:10 |
Message-ID: | CAFvQSYT3AOi7FT3XkhGP7PsJRpJNgTv6i=zMxxcmXUFMxxqLBw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
The idea is basically to always update the "synced" column to false, unless
a value has been provided manually in the UPDATE-clause.
Synced is defined as BOOLEAN DEFAULT FALSE;
I execute this function in a BEFORE UPDATE trigger FOR EACH ROW, however it
doesn't seem to have any effect.
Any ideas what could be wrong here?
Thanks, Clemens
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2013-04-05 20:21:22 | Re: BEFORE UPDATE trigger doesn't change column value |
Previous Message | Tom Lane | 2013-04-05 16:52:15 | Re: Bug or feature? (The constraint of the domain of extension can be dropped...) |