diff --git a/pkg/sql/planner.go b/pkg/sql/planner.go index 2434b2246ba9..e6076bd1dc27 100644 --- a/pkg/sql/planner.go +++ b/pkg/sql/planner.go @@ -283,7 +283,11 @@ func (p *planner) resumeFlowForPausablePortal(recv *DistSQLReceiver) error { } recv.discardRows = p.instrumentation.ShouldDiscardRows() recv.outputTypes = p.pausablePortal.pauseInfo.resumableFlow.outputTypes - p.pausablePortal.pauseInfo.resumableFlow.flow.Resume(recv) + flow := p.pausablePortal.pauseInfo.resumableFlow.flow + finishedSetupFn, cleanup := getFinishedSetupFn(p) + finishedSetupFn(flow) + defer cleanup() + flow.Resume(recv) return recv.commErr }