X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9DAD8D1B53E for ; Fri, 3 Oct 2003 12:06:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 21707-09 for ; Fri, 3 Oct 2003 09:06:05 -0300 (ADT) Received: from mail.seaworthysystems.com (216-238-112-88.dsl.ct.thebiz.net [216.238.112.88]) by svr1.postgresql.org (Postfix) with ESMTP id 80E74D1B500 for ; Fri, 3 Oct 2003 09:06:01 -0300 (ADT) Received: from seaworthysystems.com (localhost.localdomain [127.0.0.1]) by mail.seaworthysystems.com (Postfix) with SMTP id 04F3F1B5E3; Fri, 3 Oct 2003 08:12:29 -0400 (EDT) Received: from 216.238.112.88 (SquirrelMail authenticated user btober) by $HOSTNAME with HTTP; Fri, 3 Oct 2003 08:12:29 -0400 (EDT) Message-ID: <64637.216.238.112.88.1065183149.squirrel@$HOSTNAME> Date: Fri, 3 Oct 2003 08:12:29 -0400 (EDT) Subject: Re: How to figure out when was a table created From: To: In-Reply-To: References: X-Priority: 3 Importance: Normal Cc: , X-Mailer: SquirrelMail (version 1.2.9) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.2 tagged_above=0.0 required=5.0 tests=IN_REP_TO, NO_REAL_NAME, QUOTED_EMAIL_TEXT, RCVD_IN_OSIRUSOFT_COM, REFERENCES, REPLY_WITH_QUOTES X-Spam-Level: * X-Archive-Number: 200310/51 X-Sequence-Number: 15451 Can you add two columns to the table creation definition, one with a default current timestamp, the second to be updated with current time in an on update trigger. Then perhaps you could do something like SELECT min(new_insert_timestamp_column), max(new_update_timestamp_column) FROM your_table; to get the table-wide date of first entry and last update. ~Berend Tober > > Well, in certain filesystems you can have the birth time > (like ufs2) stored in the inode struct. > > So you find the file name in your $PGDATA/base directory > using the oid of your table (in pg_class), > and then you open that file with stat (2) or utimes (2) (or > from perl) to read creation data. > > All that apply for FreeBSD, see if creation time is supported > in ext2/3. > > On Thu, 2 Oct 2003, David B wrote: > >> Hi folks, >> >> I posted this question a few days ago and got no response so I guess >> it cannot be done (surprising!) >> So that leaves me with my business problem. >> >> We create a table for each days activity. >> After N days (typically 7 days) we can drop the table. >> The table name is not known so cannot force business to make >> tablename something like mydata_MMDDYY >> >> I'd like to be able to do something like: >> SELECT tablename >> FROM pg_??? >> WHERE to_char( ???, 'dd/mm/yy' ) = to_char( now() - interval '7 >> days', >> 'dd/mm/yy' ) >> >> Any suggestions? >> >> --- Prior msg was: >> >> Folks, >> >> I have a list of tables for which I want to get the date they were >> created...and if possible the date last updateded. >> >> I suspect there is a pg_??? table that can answer this question but I >> don't know what it is and I cannot find it mentioned in any docs. >> >> Any suggestions...tia