-
January 13th, 2022, 08:07 AM
#1
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 ?
-
January 13th, 2022, 11:59 AM
#2
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 ?
-
January 13th, 2022, 12:49 PM
#3
Re: Get all tables under a database in Postgre
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.
Victor Nijegorodov
-
January 13th, 2022, 12:58 PM
#4
Re: Get all tables under a database in Postgre
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?
Victor Nijegorodov
-
January 13th, 2022, 02:17 PM
#5
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 ...
-
January 13th, 2022, 03:35 PM
#6
Re: Get all tables under a database in Postgre
Sorry, Postgre is like a dark forest for me.
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|