From: Graham Vickrage <graham@digitalplanit.com>
To: Postgres SQL <pgsql-sql@postgresql.org>
Subject: trigger on table
Date: Thu, 14 Feb 2002 12:17:02 -0000
Message-ID: <NDBBJABDILOPAOOMFJHOIEMHDDAA.graham@digitalplanit.com> (raw)
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
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: graham@digitalplanit.com
Subject: Re: trigger on table
In-Reply-To: <NDBBJABDILOPAOOMFJHOIEMHDDAA.graham@digitalplanit.com>
* 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