Datenbanken (evtl. das ‚public‘ weglassen):
SELECT datname FROM pg_database
Tabellen:
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'
Spalten einer Tabelle:
SELECT column_name FROM information_schema.columns WHERE table_name = 'table'