| From: | "Graham Vickrage" <graham(at)digitalplanit(dot)com> |
|---|---|
| To: | "Postgres SQL" <pgsql-sql(at)postgresql(dot)org> |
| Subject: | trigger on table |
| Date: | 2002-02-14 12:17:02 |
| Message-ID: | NDBBJABDILOPAOOMFJHOIEMHDDAA.graham@digitalplanit.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hano de la Rouviere | 2002-02-14 12:27:19 | Re: trigger on table |
| Previous Message | Torbj=?ISO-8859-1?B?9g==?=rn Andersson | 2002-02-14 10:18:06 | Re: How long does it take? |