Issue #3185400 by mondrake, alexpott, daffie: Test upsert return value and ensure that they are consistent regardless of database type
mentioned in commit cdf89cb5