Postgres bugfixes, WIP.