From: Ludwig Lim <lud_nowhere_man@yahoo.com>
To: Tim Perdue <tim@perdue.net>
Cc: PostgreSQL Mailing List <pgsql-sql@postgresql.org>
Subject: Re: pl/pgsql question
Date: Tue, 17 Dec 2002 20:29:33 -0800 (PST)
Message-ID: <20021218042933.1012.qmail@web80310.mail.yahoo.com> (raw)
In-Reply-To: <3DFFF5AB.1080004@perdue.net>
--- Tim Perdue <tim@perdue.net> wrote:
> I have created a function in pl/pgsql to modify a
> row before it gets put
> into the database, but it seems my modification is
> being ignored, and
> the unmodified row is being inserted.
>
> I have confirmed with this RAISE EXCEPTION that my
> "NEW" row is modified
> properly, however it is not being stored in the db.
>
> NEW.start_date := NEW.start_date+delta;
> -- RAISE EXCEPTION ''new start date: %
> '',NEW.start_date;
> NEW.end_date := NEW.end_date+delta;
>
> It's probably something very obvious, but I'm
> mystified.
>
> CREATE TRIGGER projtask_insert_depend_trig AFTER
> INSERT ON project_task
> FOR EACH ROW EXECUTE PROCEDURE
> projtask_insert_depend();
>
>
Try changing the "AFTER" to "BEFORE"
CREATE TRIGGER projtask_insert_depend_trig BEFORE...
Changes made to the "NEW" will not be reflect in the
AFTER trigger since, the row is already inserted.
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: lud_nowhere_man@yahoo.com, tim@perdue.net
Subject: Re: pl/pgsql question
In-Reply-To: <20021218042933.1012.qmail@web80310.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox