Re: List of tables with a query
Anthony E . Greene <agreene@pobox.com>
From: "Anthony E. Greene" <agreene@pobox.com>
To: pgsql-novice@postgresql.org
Date: 2000-06-06T09:36:42Z
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@pobox.com> PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26 C484 A42A 60DD 6C94 239D Linux: The choice of a GNU Generation.