postgres - timestamp on a table when it was created?

Jon Jensen jon at endpoint.com
Tue Mar 3 16:03:41 MST 2009


On Tue, 3 Mar 2009, Merrill Oveson wrote:

> I'm using postgres.
>
> I need to know when tables are created.
>
> I couldn't find anything in the pg_catalog views -e.g view 
> pg_stat_user_tables.
>
> Anybody out there know of a solution?

I don't know of a nice solution, because I don't think the system tables 
track that and you can't put triggers on the system tables to add your own 
tracking.

You can gather some information from matching the OID to the actual files 
in the data directory, but that's pretty grubby and would really only be 
useful for watching the data directory for new files and reverse 
engineering what tables were created.

Another possibility is logging your DDL statements, and archiving the 
table create time from there with an out-of-band process.

All of which is pretty lame and probably isn't what you were hoping for. 
Sorry. :)

Jon

-- 
Jon Jensen
End Point Corporation
http://www.endpoint.com/



More information about the PLUG mailing list