Thread: List of tables with a query
Hi everybody, I'm a novice in postgres database administration. I'm looking for the tables or views witch containt the list of my database 's objects. I know that a psql command "\d <table_name>" give me the detail of my <table_name>, but i want to have the same result (or something similar) with a query. Is it possible, for example, with postgresql 6.5, to have the list of my tables (or all the columns of all tables ) with a single query ? Thanks for all your answers (and sorry for my bad english)
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.