maintaining a field for every UPDATION.

From: Bhuvan A <bhuvansql(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: maintaining a field for every UPDATION.
Date: 2002-01-04 06:47:45
Message-ID: Pine.LNX.4.20.0201041204380.14469-100000@Larry.bks
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hello all,

My need is something like this..

Consider in my database i have around 200 tables. In all my tables i
would like to maintain below 2 mandatory fields.

create_time timestamp,
modify_time timestamp.

So, for every insertions i would like to maintain create_time and i
had it, by setting default value to now() to that column.

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 ?

Thankx in advance.

======================================================================
Of course you have a purpose -- to find a purpose.
======================================================================

Regards,
Bhuvaneswar.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Katona Gabor 2002-01-04 08:08:50 Re: How to union tables and have a field with UNIQUE constraint?
Previous Message Christopher Kings-Lynne 2002-01-04 01:59:47 Re: top?