
77 databases in data/base directory ... all number'd ...

select * from pg_database;

doesn't give me the reference to which directory is which database ... so
what table do we need to join on to get this information?

thanks ...

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org


Sat, 14 Apr 2001 15:04:32 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Name -> number ...
> 
> 77 databases in data/base directory ... all number'd ...
> 
> select * from pg_database;
> 
> doesn't give me the reference to which directory is which database ... so
> what table do we need to join on to get this information?
> 
> thanks ...

Info is in pg_class.relfilenode.  Now the big question is where do
database names go.  My guess is pg_database.oid.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Sat, 14 Apr 2001 14:31:46 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Name -> number ...
The Hermit Hacker <scrappy@hub.org> writes:
> 77 databases in data/base directory ... all number'd ...

> select * from pg_database;

> doesn't give me the reference to which directory is which database ... so
> what table do we need to join on to get this information?

select oid, datname from pg_database;

I think Bruce did a contrib utility to keep track of this, too.

			regards, tom lane

Sat, 14 Apr 2001 14:40:59 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Name -> number ... 

d'oh, should  have extended my query ...

select oid,* from pg_database;

gives the directory name ...

thanks :)


On Sat, 14 Apr 2001, Bruce Momjian wrote:

> >
> > 77 databases in data/base directory ... all number'd ...
> >
> > select * from pg_database;
> >
> > doesn't give me the reference to which directory is which database ... so
> > what table do we need to join on to get this information?
> >
> > thanks ...
>
> Info is in pg_class.relfilenode.  Now the big question is where do
> database names go.  My guess is pg_database.oid.
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
>

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org


Sat, 14 Apr 2001 15:47:36 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Re: Name -> number ...
> 
> d'oh, should  have extended my query ...
> 
> select oid,* from pg_database;
> 
> gives the directory name ...
> 

Interesting to not that reffilenode is for tables, but oid is for
databases.  I hadn't realized that distinction until you asked.  You
can't rename databases, so the oid is OK for this.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Sat, 14 Apr 2001 14:52:58 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Name -> number ...