From: grant@intekom.com
To: pgsql-sql@postgresql.org
Subject: Adding a rule to update a last_changed field
Date: Fri, 22 Oct 1999 08:03:05 -0700
Message-ID: <221099295.28982@212.53.64.128> (raw)
I'm trying to use a rule to maintain a last_changed field.
Using something like:
CREATE RULE rule1 AS
ON UPDATE TO thetable
DO UPDATE thetable SET last_changed = now()
WHERE id = new.id;
This obviously doesn't work as the DO UPDATE triggers the rule
again, thus looping meaninglessly.
Is there a neat way to work around this? I'd like to just assign
now() to the last_changed field before the actual SQL update
code is run.
Thanks
-----
Sent using MailStart.com ( http://MailStart.Com/welcome.html )
The FREE way to access your mailbox via any web browser, anywhere!
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: grant@intekom.com
Subject: Re: Adding a rule to update a last_changed field
In-Reply-To: <221099295.28982@212.53.64.128>
References: <221099295.28982@212.53.64.128>
* 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