Table name from directory

Started by Jason Armstrongabout 16 years ago3 messagesgeneral
Jump to latest
#1Jason Armstrong
ja@riverdrums.com

How do I get the name of a database from a directory on disk (eg
$datadir/base/16494)?

--
Jason Armstrong

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jason Armstrong (#1)
Re: Table name from directory

Jason Armstrong <ja@riverdrums.com> writes:

How do I get the name of a database from a directory on disk (eg
$datadir/base/16494)?

That number should match the pg_database.oid column.

regards, tom lane

#3Scott Marlowe
scott.marlowe@gmail.com
In reply to: Jason Armstrong (#1)
Re: Table name from directory

On Fri, Jan 15, 2010 at 7:59 AM, Jason Armstrong <ja@riverdrums.com> wrote:

How do I get the name of a database from a directory on disk (eg
$datadir/base/16494)?

There's a handy little utility called oid2name you can use to do it
from the command line.