From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Chuming Chen <chen(at)musc(dot)edu> |
Cc: | pgsql-admin list <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: correspondence between the numbered folder and actual database |
Date: | 2004-12-10 23:15:51 |
Message-ID: | 20041210231551.GA61422@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
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/
From | Date | Subject | |
---|---|---|---|
Next Message | itamar | 2004-12-11 00:15:46 | |
Previous Message | Ron Peterson | 2004-12-10 20:20:50 | fallback authentication |