Postgres fixes

same fix for postgres as for mysql + soem debug statements