X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 500583A6A3E for ; Sat, 11 Dec 2004 00:45:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48133-04 for ; Sat, 11 Dec 2004 00:44:51 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 9E9A53AA2DD for ; Fri, 10 Dec 2004 23:16:00 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id iBANFqHG004662 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Dec 2004 16:15:57 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id iBANFqR6061498; Fri, 10 Dec 2004 16:15:52 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id iBANFqsb061497; Fri, 10 Dec 2004 16:15:52 -0700 (MST) (envelope-from mfuhr) Date: Fri, 10 Dec 2004 16:15:51 -0700 From: Michael Fuhr To: Chuming Chen Cc: pgsql-admin list Subject: Re: correspondence between the numbered folder and actual database Message-ID: <20041210231551.GA61422@winnie.fuhr.org> References: <41B6FCB7.8040100@musc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41B6FCB7.8040100@musc.edu> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/81 X-Sequence-Number: 15667 On Wed, Dec 08, 2004 at 08:08:07AM -0500, Chuming Chen wrote: > Is there any way I can find the correspondence between the numbered > folders under postgresql data/base and the actual database name or table > name? You could use contrib/oid2name. If you want to do it yourself, look at the pg_database.oid and pg_class.relfilenode fields. For example, given a file $PGDATA/base/164531/183620, the database database OID is 164531 and the table or index filenode is 183620. Find out what database the object is in with the following query: SELECT datname FROM pg_database WHERE oid = 164531; datname --------- test Connect to that database and issue the following query: SELECT n.nspname, c.relname FROM pg_class AS c JOIN pg_namespace AS n ON n.oid = c.relnamespace WHERE relfilenode = 183620; nspname | relname ---------+--------- public | foo -- Michael Fuhr http://www.fuhr.org/~mfuhr/