trigger on table - Mailing list pgsql-sql

From Graham Vickrage
Subject trigger on table
Date
Msg-id NDBBJABDILOPAOOMFJHOIEMHDDAA.graham@digitalplanit.com
Whole thread Raw
Responses Re: trigger on table  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-sql
I am trying to create a trigger on a table that simply sets the last_updated
field when any updates are made to that table.

I have tried the following: -

CREATE FUNCTION set_item_last_updated () RETURNS OPAQUE AS '
BEGIN
UPDATE item SET last_updated = now();
RETURN OLD;
END;' LANGUAGE 'plpgsql';

CREATE TRIGGER item_last_updated AFTER UPDATE ON item
FOR EACH ROW EXECUTE PROCEDURE set_item_last_updated();

When I try to execute this it hangs and postmaster eventually runs out of
memory.

Is there a way to do it just using sql not plpsql?
Why is it hanging?

Thank in advance.

Graham




pgsql-sql by date:

Previous
From: Torbjörn Andersson
Date:
Subject: Re: How long does it take?
Next
From: "PGExplorer"
Date:
Subject: Re: trigger on table