List all databases and tables
databases
SELECT datname FROM pg_database WHERE datistemplate = false;
tables
SELECT table_name FROM information_schema.tables where table_catalog='tablespace' and table_schema='public' and table_type='BASE TABLE' ORDER BY 1;