Get all tables under a database in Postgre
I need to get all database names, using SQL script only. I have tried:
Code:
SELECT datname FROM pg_database WHERE datistemplate = false
and seem to work. I got:
Code:
mydb1
mydb2
postgres
mybd1 and mydb2 have been created by me. So far, so good. Now, I need to find all tables under every database, using SQL script only. Is it possible ?
Re: Get all tables under a database in Postgre
It's possible to have tables that is not part of any database in Postgre SQL ?
Re: Get all tables under a database in Postgre
Quote:
Originally Posted by
mesajflaviu
I need to get all database names, using SQL script only. I have tried:
Code:
SELECT datname FROM pg_database WHERE datistemplate = false
and seem to work. I got:
Code:
mydb1
mydb2
postgres
mybd1 and
mydb2 have been created by me. So far, so good. Now, I need to find all tables under every database, using SQL script only. Is it possible ?
I replied here.
Re: Get all tables under a database in Postgre
Quote:
Originally Posted by
mesajflaviu
It's possible to have tables that is not part of any database in Postgre SQL ?
Is it possible to create/have a table not belonging to any database? :confused:
Re: Get all tables under a database in Postgre
Yes, make no sense, but I create 2-3 dummy databases, and I don;t know how to select them, but even so, I can create tables, which belongs to no database !!! Why ? Because, if I delete all dummy databases, the new created tables remain ...
Yes, today I used Postgre, and don't understand how it works ...
Re: Get all tables under a database in Postgre
Sorry, Postgre is like a dark forest for me. :cry: