dont run delete query when there's nothing to delete
This commit is contained in:
parent
912a689701
commit
09c585cdb1
1 changed files with 5 additions and 0 deletions
|
@ -80,6 +80,11 @@ func deleteConflictsBeforeMerge(tx *sql.Tx, conflict conflictingUniqueKey, prima
|
|||
args = append(args, value)
|
||||
}
|
||||
|
||||
// if no rows found, no need to delete anything
|
||||
if len(args) < 2 {
|
||||
return nil
|
||||
}
|
||||
|
||||
query = fmt.Sprintf(
|
||||
"DELETE FROM %s WHERE %s = %s AND %s IN (%s)",
|
||||
conflict.table, conflict.objectIdColumn, strmangle.Placeholders(dialect.IndexPlaceholders, 1, 1, 1),
|
||||
|
|
Loading…
Reference in a new issue