← Back to all TILs

List All The Databases

postgres Written March 06, 2016

There are two ways to list all the available databases. The first is a psql only command:

\list

The second approach is to query the pg_database table. Something like the following will suffice:

select datname from pg_database;

Other posts like this