Fixed test failures on postgresql