diff --git a/go/vt/vtgate/engine/fk_verify.go b/go/vt/vtgate/engine/fk_verify.go index 82a1a01309b..3668792d840 100644 --- a/go/vt/vtgate/engine/fk_verify.go +++ b/go/vt/vtgate/engine/fk_verify.go @@ -82,7 +82,7 @@ func (f *FkVerify) TryExecute(ctx context.Context, vcursor VCursor, bindVars map } result, err := vcursor.ExecutePrimitive(ctx, f.Exec, bindVars, wantfields) - if err == nil { + if result != nil { result.MergeStats(stats) } return result, err diff --git a/go/vt/vtgate/engine/insert_select.go b/go/vt/vtgate/engine/insert_select.go index f843116f4cb..d6477118b63 100644 --- a/go/vt/vtgate/engine/insert_select.go +++ b/go/vt/vtgate/engine/insert_select.go @@ -315,7 +315,7 @@ func (ins *InsertSelect) execInsertSharded(ctx context.Context, vcursor VCursor, } result, err := ins.insertIntoShardedTable(ctx, vcursor, bindVars, selectResult) - if err == nil { + if result != nil { result.MergeStats(selectResult.stats) }