Select list of table names for particular DB

From: webbj2(at)Scranton(dot)edu
To: pgsql-general(at)postgresql(dot)org
Subject: Select list of table names for particular DB
Date: 2005-12-18 17:18:04
Message-ID: 10c42d9d1.d9d110c42@scranton.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi
I am trying to figure out how to get (select) a list of all the names of
the tables in a database when given the name of the database. ie.,
Select table_name from ??? where datbase name = "XYZ";
I can easily select names of tables in current db like this:
SELECT datname FROM pg_database;

But, if I want to retrieve all table names for a different db, I can
not figure it out.
I looked at doc for pg_class and can find a relation name but no ID#.
I thought maybe I could find a database ID related to table IDs, but
can not determine what a databases classID might be or what a tables
ID might be.

What system catalogs do I need to access for this information?

Thanks
Jeff

Jeff Webb
University of Scranton

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Ang 2005-12-18 18:25:19 installing tsearch 2 error no user "root"
Previous Message Karsten Hilbert 2005-12-18 16:12:28 Re: is this a bug or I am blind?