MDL-43761 use atomic db changes in pg

This should partially help with recovery from interrupted installs.