From ec312070842b8c5772739309fd9b9c1b105156bf Mon Sep 17 00:00:00 2001 From: Jason Fulghum Date: Fri, 14 Mar 2025 15:46:05 -0700 Subject: [PATCH] Bug fix: Call StatementBegin for all TableEditors used in insertIter --- sql/rowexec/dml.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sql/rowexec/dml.go b/sql/rowexec/dml.go index 99b148a435..113b8fae7d 100644 --- a/sql/rowexec/dml.go +++ b/sql/rowexec/dml.go @@ -101,9 +101,15 @@ func (b *BaseBuilder) buildInsertInto(ctx *sql.Context, ii *plan.InsertInto, row } if ii.Ignore { + // If ignore is set, then we are either replacing or inserting, but not updating on conflicts return plan.NewCheckpointingTableEditorIter(insertIter, ed), nil } else { - return plan.NewTableEditorIter(insertIter, ed), nil + // Otherwise, we are potentially inserting AND updating if there are conflicts + eds := []sql.EditOpenerCloser{ed} + if updater != nil { + eds = append(eds, updater) + } + return plan.NewTableEditorIter(insertIter, eds...), nil } }