Re: List of tables with a query - Mailing list pgsql-novice

From Anthony E. Greene
Subject Re: List of tables with a query
Date
Msg-id 3.0.5.32.20000606113642.007ed100@fmol.5sigcmd.army.mil
Whole thread Raw
In response to List of tables with a query  (NRonayette <r97m10@socotec.fr>)
List 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@pobox.com>
 PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
 Linux: The choice of a GNU Generation.

pgsql-novice by date:

Previous
From: Christopher Sawtell
Date:
Subject: Re: [SQL] moving DB
Next
From: patrick.wolf@Aerojet.com (WOLF, PATRICK)
Date:
Subject: RE: moving DB