Skip to content

Commit f61a772

Browse files
authored
Merge pull request #2892 from dolthub/fulghum/on_duplicate
Bug fix: Call `StatementBegin` for all TableEditors used in `insertIter`
2 parents a4f4b07 + ec31207 commit f61a772

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sql/rowexec/dml.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,15 @@ func (b *BaseBuilder) buildInsertInto(ctx *sql.Context, ii *plan.InsertInto, row
101101
}
102102

103103
if ii.Ignore {
104+
// If ignore is set, then we are either replacing or inserting, but not updating on conflicts
104105
return plan.NewCheckpointingTableEditorIter(insertIter, ed), nil
105106
} else {
106-
return plan.NewTableEditorIter(insertIter, ed), nil
107+
// Otherwise, we are potentially inserting AND updating if there are conflicts
108+
eds := []sql.EditOpenerCloser{ed}
109+
if updater != nil {
110+
eds = append(eds, updater)
111+
}
112+
return plan.NewTableEditorIter(insertIter, eds...), nil
107113
}
108114
}
109115

0 commit comments

Comments
 (0)