Issue #3185400 by mondrake, alexpott, daffie: Test upsert return value and ensure that they are consistent regardless of database type (cherry picked from commit d8ab4a9e)