Fixes bug 1032851 - add a retry if we get a duplicate on UPSERT

this should be lifter into the next outer scope rather than here.  By the time the second call to ```execute_no_results``` the connection is in an error state and is not usable.