Skip to content

Commit

Permalink
Also check the lenght of the row vs number of columns
Browse files Browse the repository at this point in the history
  • Loading branch information
mjonss committed Apr 20, 2022
1 parent 4c85967 commit b1c8468
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions table/tables/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -1285,9 +1285,8 @@ func partitionedTableUpdateRecord(gctx context.Context, ctx sessionctx.Context,
// 'Key Already Exists' will generally happen during step1, errors are
// unlikely to happen in step2.
deleteData := currData
if !t.Meta().IsCommonHandle && !t.Meta().PKIsHandle {
if !t.Meta().IsCommonHandle && !t.Meta().PKIsHandle && len(deleteData) > len(t.Cols()) {
// The row already has the handle column added, remove it since it is not expected in RemoveRecord!
// TODO: Should we also verify that the handle actually is int and is equal to the last column in the row?
deleteData = deleteData[:len(deleteData)-1]
}
err = t.GetPartition(from).RemoveRecord(ctx, h, deleteData)
Expand Down

0 comments on commit b1c8468

Please sign in to comment.