Hi all,
This proposal is about add a column "datcreated" on "pg_database" to store the "timestamp" of the database creation.
A couple weeks ago I had a trouble with a PostgreSQL instance, actually our ERP had some strange behaviors with some data loss, but I searched for ERRORs in log files (OS and PG) and I found nothing.
Looking at the files and directories in the cluster noticed something strange, the date / time of the file "base/9999/PG_VERSION" (database of our ERP) was different compared to when we create it. So I used the following SQL to check the date / time of creation of the databases in the cluster:
fabrizio=# SELECT datname, (pg_stat_file('base/'||oid||'/PG_VERSION')).modification AS datcreated
fabrizio-# FROM pg_database;
datname | datcreated
-----------+------------------------
template1 | 2012-12-26 12:11:53-02
template0 | 2012-12-26 12:11:54-02
postgres | 2012-12-26 12:11:54-02
fabrizio | 2012-12-26 12:12:02-02
(4 rows)
This isn't an elegant solution to do that, but worked fine. However, why not we have a column to store this information?
Somebody have another idea?
Regards,
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI:
http://fabriziomello.blogspot.com >> Perfil Linkedin:
http://br.linkedin.com/in/fabriziomello>> Twitter:
http://twitter.com/fabriziomello