Skip to content

Commit

Permalink
planner: use logical output cols to record positions of tables to be …
Browse files Browse the repository at this point in the history
…deleted (#54010)

ref #38911
  • Loading branch information
winoros authored Jun 17, 2024
1 parent 26d1096 commit e7d67b1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6285,13 +6285,7 @@ func (b *PlanBuilder) buildDelete(ctx context.Context, ds *ast.DeleteStmt) (base
b.visitInfo = appendVisitInfo(b.visitInfo, mysql.DeletePriv, dbName, v.Name.L, "", authErr)
}
}

del.SelectPlan, _, err = DoOptimize(ctx, b.ctx, b.optFlag, p)
if err != nil {
return nil, err
}

tblID2Handle, err := resolveIndicesForTblID2Handle(handleColsMap, del.SelectPlan.Schema())
tblID2Handle, err := resolveIndicesForTblID2Handle(handleColsMap, p.Schema())
if err != nil {
return nil, err
}
Expand All @@ -6314,6 +6308,12 @@ func (b *PlanBuilder) buildDelete(ctx context.Context, ds *ast.DeleteStmt) (base
if err != nil {
return nil, err
}

del.SelectPlan, _, err = DoOptimize(ctx, b.ctx, b.optFlag, p)
if err != nil {
return nil, err
}

err = del.buildOnDeleteFKTriggers(b.ctx, b.is, tblID2table)
return del, err
}
Expand Down

0 comments on commit e7d67b1

Please sign in to comment.