From: Leif B. Kristensen <leif@solumslekt.org>
To: Pgsql-sql@postgresql.org <Pgsql-sql@postgresql.org>
Subject: Re: Triggers
Date: Tue, 22 Nov 2005 18:17:23 +0100
Message-ID: <200511221817.23593.leif@solumslekt.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0511221906301.24697-100000@matrix.gatewaynet.com>
References: <Pine.LNX.4.44.0511221906301.24697-100000@matrix.gatewaynet.com>
On Tuesday 22 November 2005 18:07, Achilleus Mantzios wrote:
>O Leif B. Kristensen ?????? ???? Nov 22, 2005 :
>> What am I missing?
>
>apparently some forgotten process_last_edited() function.
Yes -- an earlier attempt at the same thing ...
I finally managed to create my first trigger:
CREATE OR REPLACE FUNCTION update_last_edit() RETURNS TRIGGER AS $$
BEGIN
UPDATE persons SET last_edit=NOW() WHERE person_id=NEW.person_fk;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER update_last_edit
BEFORE INSERT OR UPDATE ON participants
FOR EACH ROW EXECUTE PROCEDURE update_last_edit();
And it's even working as it should :-)
Thanks, guys.
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE
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: leif@solumslekt.org
Subject: Re: Triggers
In-Reply-To: <200511221817.23593.leif@solumslekt.org>
* 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