PostgreSQL - How to list all available schemas?
How to list all available schemas in PostgreSQL?
1. Using SQL Query
You can get the list of all schemas using SQL with the ANSI standard of INFORMATION_SCHEMA:
SELECT schema_name FROM information_schema.schemata
or
SELECT nspname FROM pg_catalog.pg_namespace;
Basically, information schema is a set of views of pg_catalog.
2. Using psql
While using psql, simply use command \dn
.
3. With TablePlus
In TablePlus, you can either use the query editor and execute the statements above, or quickly navigate to the schema dropdown list at the bottom of the left sidebar.
Except the system schemas that you usually do not interact with, all the available schemas will be listed here, including the empty ones. To also see the system schemas, select the dropdown next to the +
button > Settings > Show System Schemas.
Need a good GUI tool for PostgreSQL? Check out TablePlus. It’s native, beautiful, and available for free.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS