\l: for list all databases.
-- Query to get all database in PostgreSQL and their oid (alternative to \l) SELECT oid, datname FROM pg_database;