Don't lose uncommitted data on DB retries

Backport ompgsql2 patch to avoid losing uncommitted data on DB retries.

Bugzilla bug for this issue: http://bugzilla.adiscon.com/show_bug.cgi?id=528
Original ompgsql2 patch: http://bugzilla.adiscon.com/show_bug.cgi?id=453#c5