Break out database connection and query into Postgres adapter with common interface.