Last Python 3 fixes - all tests pass for postgresql