Properly read database name in yaml config for postgres

Also log queries that are being run