From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Bhuvan A <bhuvansql@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: maintaining a field for every UPDATION.
Date: Fri, 4 Jan 2002 00:19:53 -0800 (PST)
Message-ID: <20020104000537.N18170-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <Pine.LNX.4.20.0201041204380.14469-100000@Larry.bks>
On Fri, 4 Jan 2002, Bhuvan A wrote:
> Well, now i would like to maintain modify_time for every updation. how
> can i? Using common plpgsql function i cant even able to refer OID
> even during UPDATION. The result is
>
> ERROR: record old has no field oid
> or
> ERROR: record new has no field oid
>
> One way: i can have seperate plpgsql function for every table and
> apply conditions accordingly. But i dont think thats the consistent
> way.
>
> how else can i maintain modify_time field ?
Would a before update trigger function something like:
begin
NEW.modify_time=now();
return NEW;
end;
do what you want?
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: sszabo@megazone23.bigpanda.com, bhuvansql@yahoo.com
Subject: Re: maintaining a field for every UPDATION.
In-Reply-To: <20020104000537.N18170-100000@megazone23.bigpanda.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