(TIL) PSQL: List All The Databases

less than 1 minute read

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

\list

with a short form of \l.

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

select datname from pg_database;

Via jbranchaud/til.

Comments