More postgres bug fixes