Search Postgresql Archives

Dynamic update of a date field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,

I have a question concerning default value/trigger function which supposed to update/fill field called time_stamp whenever a 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 could somehow fetch it to_timestamp() function in the Default definition of the field (while creating a table) or create a trigger function which doesn't require the table name (or retrieve it dynamically) and which is executed whenever a row is added to any table.

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

Thank you in advance,

Jan Musial
-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux