planner,executor: fix point get for update read panic on partition table (#25537)
This commit is contained in:
@ -3018,3 +3018,13 @@ PARTITION BY RANGE (a) (
|
||||
s.testData.GetTestCases(c, &input, &output)
|
||||
s.verifyPartitionResult(tk, input, output)
|
||||
}
|
||||
|
||||
func (s *partitionTableSuite) TestIssue25528(c *C) {
|
||||
tk := testkit.NewTestKit(c, s.store)
|
||||
tk.MustExec("set @@tidb_partition_prune_mode = 'static'")
|
||||
tk.MustExec("use test")
|
||||
tk.MustExec("create table issue25528 (id int primary key, balance DECIMAL(10, 2), balance2 DECIMAL(10, 2) GENERATED ALWAYS AS (-balance) VIRTUAL, created_at TIMESTAMP) PARTITION BY HASH(id) PARTITIONS 8")
|
||||
tk.MustExec("insert into issue25528 (id, balance, created_at) values(1, 100, '2021-06-17 22:35:20')")
|
||||
tk.MustExec("begin pessimistic")
|
||||
tk.MustQuery("select * from issue25528 where id = 1 for update").Check(testkit.Rows("1 100.00 -100.00 2021-06-17 22:35:20"))
|
||||
}
|
||||
|
||||
@ -732,6 +732,15 @@ func (ds *DataSource) findBestTask(prop *property.PhysicalProperty, planCounter
|
||||
if hashPartColName == nil {
|
||||
canConvertPointGet = false
|
||||
}
|
||||
} else {
|
||||
// If the schema contains ExtraPidColID, do not convert to point get.
|
||||
// Because the point get executor can not handle the extra partition ID column now.
|
||||
for _, col := range ds.schema.Columns {
|
||||
if col.ID == model.ExtraPidColID {
|
||||
canConvertPointGet = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if canConvertPointGet {
|
||||
|
||||
Reference in New Issue
Block a user