handle weird update n by mysql

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
Andrew Thornton 2023-03-15 13:56:37 +00:00
parent 344985f6bd
commit d7eb965a92
No known key found for this signature in database
GPG Key ID: 3CDE74631F13A748
1 changed files with 5 additions and 0 deletions

View File

@ -145,6 +145,11 @@ func (session *Session) upsertMap(doUpdate bool, columns []string, args []interf
if err != nil {
return 0, err
}
if doUpdate && session.engine.dialect.URI().DBType == schemas.MYSQL && affected == 2 {
// for MYSQL if INSERT ... ON CONFLICT RowsAffected == 2 means UPDATE
affected = 1
}
return affected, nil
}