| From: | "Anthony E(dot) Greene" <agreene(at)pobox(dot)com> | 
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org | 
| Subject: | Re: List of tables with a query | 
| Date: | 2000-06-06 09:36:42 | 
| Message-ID: | 3.0.5.32.20000606113642.007ed100@fmol.5sigcmd.army.mil | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-novice | 
At 09:44 2000-06-06 +0100, NRonayette wrote:
>I'm looking for the tables or views witch containt the list of my
>database 's objects.
This will get you a list of databases:
SELECT datname FROM pg_database
Then for each database name returned, connect to the database and run:
SELECT relname FROM pg_class WHERE relname NOT LIKE 'pg_%' AND relkind='r'
I use perl and put the results of the first query into an array. I step
through the array, connect to each database, and get the list of tables
using the second query.
 Tony
 --
 Anthony E. Greene <agreene(at)pobox(dot)com>
 PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
 Linux: The choice of a GNU Generation.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | WOLF, PATRICK | 2000-06-06 14:23:39 | RE: moving DB | 
| Previous Message | NRonayette | 2000-06-06 08:44:40 | List of tables with a query |