Please note the following commands:
\listor\l: list all databases\c <db name>: connect to a certain database\dt: list all tables in the current database using yoursearch_path\dt *.: list all tables in the current database regardless yoursearch_path
You will never see tables in other databases, these tables aren't visible. You have to connect to the correct database to see its tables (and other objects).
To switch databases:
\connect database_name or \c database_name
See the manual about psql.
Answer from Frank Heikens on Stack ExchangePlease note the following commands:
\listor\l: list all databases\c <db name>: connect to a certain database\dt: list all tables in the current database using yoursearch_path\dt *.: list all tables in the current database regardless yoursearch_path
You will never see tables in other databases, these tables aren't visible. You have to connect to the correct database to see its tables (and other objects).
To switch databases:
\connect database_name or \c database_name
See the manual about psql.
This lists databases:
SELECT datname FROM pg_database
WHERE datistemplate = false;
This lists tables in the current database
SELECT table_schema,table_name
FROM information_schema.tables
ORDER BY table_schema,table_name;
postgresql - How to list databases in terminal in PostgresSQL? - Stack Overflow
Get a list of available PostgreSQL databases
show tables in current database using psql
Dumb question - postgresql db file location?
Thanks to @Michał Sznurawa for pointing me in the right direction - from the Mac terminal, using psql -l, rather than psql \l does the trick.
This lists all databases:
SELECT datname FROM pg_database;
These list all databases in detail:
\list
\l
These list all databases in more detail:
\list+
\l+
Hello, I'm running a psql command inside of my postgres container. When running the \dt to show my database tables it's always giving me "Did not find any relations". Im pretty new in psql commands, am I missing something?
I know this is a dumb question, but I really would like to know - where is the file for the databases created in postgreSQL? I've wondered this from day 1 of using postgres and here I am, 6 months later and I'm still bothered by this.
SQLite creates a `db.sqlite3` file in your project directory, why doesn't postgres?