Skip to content

Commit

Permalink
planner: fix generated column causes a server crash (pingcap#16376)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjhuang2016 authored Apr 15, 2020
1 parent 5f05854 commit 7e71069
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6010,3 +6010,12 @@ func (s *testIntegrationSuite) TestIssue15790(c *C) {
tk.MustQuery("SELECT * FROM t0 WHERE -10000000000000000000 | t0.c0 UNION all SELECT * FROM t0;").Check(testkit.Rows("0", "0"))
tk.MustExec("drop table t0;")
}

func (s *testIntegrationSuite) TestIssue15992(c *C) {
tk := testkit.NewTestKitWithInit(c, s.store)
tk.MustExec("use test;")
tk.MustExec("CREATE TABLE t0(c0 INT, c1 INT AS (c0));")
tk.MustExec("CREATE INDEX i0 ON t0(c1);")
tk.MustQuery("SELECT t0.c0 FROM t0 UNION ALL SELECT 0 FROM t0;").Check(testkit.Rows())
tk.MustExec("drop table t0;")
}
2 changes: 1 addition & 1 deletion planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2824,7 +2824,7 @@ func (b *PlanBuilder) buildDataSource(ctx context.Context, tn *ast.TableName, as
if err != nil {
return nil, err
}
colExpr.VirtualExpr = expr
colExpr.VirtualExpr = expr.Clone()
}
}
}
Expand Down

0 comments on commit 7e71069

Please sign in to comment.