Skip site navigation (1) Skip section navigation (2)

Find list of table names for particular DB

From: webbj2(at)Scranton(dot)edu
To: pgsql-novice(at)postgresql(dot)org
Subject: Find list of table names for particular DB
Date: 2005-12-18 21:02:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
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, not
necessarily the current DB. ie.,
Select table_name from ??? where database_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.


pgsql-novice by date

Next:From: Mogin MohandasDate: 2005-12-19 03:41:29
Subject: procedures for adding data
Previous:From: John DeSoiDate: 2005-12-18 14:00:00
Subject: Re: Login problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group