Postgres integration

This patch introduces initial support for Postgres.