Skip to content

Commit

Permalink
executor: fix update panic on join having statement (#23554) (#23575)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored May 8, 2021
1 parent 083c299 commit e431c06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions executor/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,12 @@ func (s *testPointGetSuite) TestIssue21447(c *C) {
tk1.MustQuery("select * from t1 where id in (1, 2) for update").Check(testkit.Rows("1 xyz"))
tk1.MustExec("commit")
}

func (s *testPointGetSuite) TestIssue23553(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec(`use test`)
tk.MustExec(`drop table if exists tt`)
tk.MustExec(`create table tt (m0 varchar(64), status tinyint not null)`)
tk.MustExec(`insert into tt values('1',0),('1',0),('1',0)`)
tk.MustExec(`update tt a inner join (select m0 from tt where status!=1 group by m0 having count(*)>1) b on a.m0=b.m0 set a.status=1`)
}
3 changes: 3 additions & 0 deletions planner/core/rule_eliminate_projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ func doPhysicalProjectionElimination(p PhysicalPlan) PhysicalPlan {
return p
}
child := p.Children()[0]
if childProj, ok := child.(*PhysicalProjection); ok {
childProj.SetSchema(p.Schema())
}
return child
}

Expand Down

0 comments on commit e431c06

Please sign in to comment.