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 via email to