Fixed #20761 -- Fixed DatabaseError handling in get_or_create and update_or_create.