Skip site navigation (1) Skip section navigation (2)

Re: trigger function in plpgsql (newbie)

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Gunnar Lindholm <gunnar(at)gunix(dot)mine(dot)nu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: trigger function in plpgsql (newbie)
Date: 2001-10-28 18:02:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Sun, 28 Oct 2001, Gunnar Lindholm wrote:

> create trigger trigger_happy AFTER INSERT ON  T2
>     for each ROW EXECUTE PROCEDURE func_cal();

I think the only problem is that you want a BEFORE INSERT trigger, not
an AFTER INSERT trigger (before triggers can modify the row that is
inserted directly, since the row hasn't been inserted yet).  You may
also want to consider doing this for UPDATE as well since otherwise
the v1*v2 value won't be updated unless you do it manually.

In response to

pgsql-general by date

Next:From: Patrice HédéDate: 2001-10-28 18:03:05
Subject: Re: UNICODE
Previous:From: Stephan SzaboDate: 2001-10-28 17:57:57
Subject: Re: Problem with some function

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group