Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0A66215F61C4 for ; Wed, 16 Nov 2011 20:02:37 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 33652-06 for ; Thu, 17 Nov 2011 00:02:31 +0000 (UTC) Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id C8E3015F61C3 for ; Wed, 16 Nov 2011 20:02:30 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RQpQv-0003Vp-0S for pgsql-general@postgresql.org; Thu, 17 Nov 2011 00:02:25 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pAH02Bc0024409; Wed, 16 Nov 2011 19:02:11 -0500 (EST) To: Andreas Kretschmer cc: pgsql-general@postgresql.org Subject: Re: How could I find the last modified procedure in the database? In-reply-to: <20111116163055.GA13297@tux> References: <20111116163055.GA13297@tux> Comments: In-reply-to Andreas Kretschmer message dated "Wed, 16 Nov 2011 17:30:55 +0100" Date: Wed, 16 Nov 2011 19:02:11 -0500 Message-ID: <24408.1321488131@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201111/601 X-Sequence-Number: 182171 Andreas Kretschmer writes: > Dhimant Patel wrote: >> I also created several procedures/functions and now I don't remember the last >> procedure I worked on! - I thought I could always get this from metadata. >> Now I'm stuck - couldn't find this details anywhere in catalog tables! >> Is there anyway I can get this information? > Maybe with this query: > select proname from pg_proc order by oid desc limit 1; > but i'm not really sure ... tias (try it and see) The OIDs would tell you the creation order, but they don't change during CREATE OR REPLACE FUNCTION; so depending on what the OP means by "worked on", this query might not be very useful to him. I'd try looking to see which row in pg_proc has the latest xmin. Unfortunately you can't "ORDER BY xmin" ... regards, tom lane