Postgres

This contains all the changes from #186, but adds additional PG support.