Dynamic update of a date field - Mailing list pgsql-general

From Musial, Jan (GIUB)
Subject Dynamic update of a date field
Date
Msg-id 9255BE145568B443A366804DA0BA275F1BF22B29@aai-exch-mbx4.campus.unibe.ch
Whole thread Raw
Responses Re: Dynamic update of a date field  (Andreas Kretschmer <akretschmer@spamfence.net>)
Re: Dynamic update of a date field  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
Dear all,

I have a question concerning default value/trigger function which supposed to update/fill field called time_stamp
whenevera row is inserted. Let say that we have a table: 
CREATE TABLE dummy (year smallint,month smallint,day smallint,time_stamp date);
I would like to update "time_stamp" dynamically without knowledge of a table name and using the values placed in the
columns:year,month,day. The trick is that I have ~2000 tables which I populate with some time information, so either I
couldsomehow fetch it to_timestamp() function in the Default definition of the field (while creating a table) or create
atrigger function which doesn't require the table name (or retrieve it dynamically) and which is executed whenever a
rowis added to any table. 

As I am new to postgres/plpgsql any suggestions are more than welcome.

Thank you in advance,

Jan Musial

pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Drop big index
Next
From: Stefan Keller
Date:
Subject: Re: [postgis-users] ST_AsJpeg