pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
correspondence between the numbered folder and actual database
2+ messages / 2 participants
[nested] [flat]

* correspondence between the numbered folder and actual database
@ 2004-12-08 13:08 Chuming Chen <chen@musc.edu>
  2004-12-10 23:15 ` Re: correspondence between the numbered folder and actual database Michael Fuhr <mike@fuhr.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Chuming Chen @ 2004-12-08 13:08 UTC (permalink / raw)
  To: pgsql-admin

Hi, all,

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?

Thank you for your suggestions.

-- 
Chuming Chen
System Administrator
NHLBI Proteomics Center
Medical University of South Carolina
135 Cannon Street, Suite 303
Charleston SC 29425
Tel: 843-792-1555 (O)
Fax: 843-876-1126





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: correspondence between the numbered folder and actual database
  2004-12-08 13:08 correspondence between the numbered folder and actual database Chuming Chen <chen@musc.edu>
@ 2004-12-10 23:15 ` Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Fuhr @ 2004-12-10 23:15 UTC (permalink / raw)
  To: Chuming Chen <chen@musc.edu>; +Cc: 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/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-12-10 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-12-08 13:08 correspondence between the numbered folder and actual database Chuming Chen <chen@musc.edu>
2004-12-10 23:15 ` Michael Fuhr <mike@fuhr.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox