SELECT current_database();
-- Query to get all database in PostgreSQL and their oid (alternative to l)
SELECT oid, datname FROM pg_database;
# List databases:
l
SELECT datname FROM pg_database;
# inside psql
l
l: for list all databases.
SELECT datname FROM pg_database;
Code language: SQL (Structured Query Language) (sql)
l
Code language: Shell Session (shell)