diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index a67dc8da7808a..98dc10584ef84 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -4808,7 +4808,20 @@ func CheckUpdateList(assignFlags []int, updt *Update, newTblID2Table map[int64]t flags := assignFlags[content.Start:content.End] var update, updatePK bool for i, col := range tbl.WritableCols() { +<<<<<<< HEAD if flags[i] >= 0 && col.State != model.StatePublic { +======= + // schema may be changed between building plan and building executor + // If i >= len(flags), it means the target table has been added columns, then we directly skip the check + if i >= len(flags) { + continue + } + if flags[i] < 0 { + continue + } + + if col.State != model.StatePublic { +>>>>>>> c76888143... executor: fix panic during update stmt (#36230) return ErrUnknownColumn.GenWithStackByArgs(col.Name, clauseMsg[fieldList]) } if flags[i] >= 0 {