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.
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+
Get a list of available PostgreSQL databases
Error in psql when trying to list databases
show tables in current database using psql
Restrict users ability to see other DB's
Videos
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.
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;
FYI, I am just switching my workflow to terminal based setup, so im still trying to figure things out