From d337bf4cd4529f079641abe76960d4aa280cceb5 Mon Sep 17 00:00:00 2001 From: xiongjiwei Date: Thu, 24 Dec 2020 11:48:32 +0800 Subject: [PATCH] parser: update parser and add test for parse identifier (#21908) --- expression/integration_test.go | 18 ++++++++++++++++++ go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/expression/integration_test.go b/expression/integration_test.go index f9af68fe5c..d11c45cc88 100644 --- a/expression/integration_test.go +++ b/expression/integration_test.go @@ -8381,6 +8381,24 @@ func (s *testIntegrationSuite) TestIssue12205(c *C) { testkit.Rows("Warning 1292 Truncated incorrect time value: '18446744072635875000'")) } +func (s *testIntegrationSuite) TestIssue21677(c *C) { + tk := testkit.NewTestKit(c, s.store) + + tk.MustExec("use test") + tk.MustExec("drop table if exists t;") + tk.MustExec("create table t(1e int);") + tk.MustExec("insert into t values (1);") + tk.MustQuery("select t.1e from test.t;").Check(testkit.Rows("1")) + tk.MustExec("drop table if exists t;") + tk.MustExec("create table t(99e int, r10 int);") + tk.MustExec("insert into t values (1, 10), (2, 2);") + tk.MustQuery("select 99e+r10 from t;").Check(testkit.Rows("11", "4")) + tk.MustQuery("select .78$123;").Check(testkit.Rows("0.78")) + tk.MustGetErrCode("select .78$421+1;", mysql.ErrParse) + tk.MustQuery("select t. `r10` > 3 from t;").Check(testkit.Rows("1", "0")) + tk.MustQuery("select * from t where t. `r10` > 3;").Check(testkit.Rows("1 10")) +} + func (s *testIntegrationSerialSuite) TestLikeWithCollation(c *C) { tk := testkit.NewTestKit(c, s.store) collate.SetNewCollationEnabledForTest(true) diff --git a/go.mod b/go.mod index f5e8e39c2a..d4655aaf30 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989 github.com/pingcap/kvproto v0.0.0-20201215060142-f3dafca4c7fd github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8 - github.com/pingcap/parser v0.0.0-20201203152619-33293d112894 + github.com/pingcap/parser v0.0.0-20201222091346-02c8ff27d0bc github.com/pingcap/sysutil v0.0.0-20201130064824-f0c8aa6a6966 github.com/pingcap/tidb-lightning v4.0.9-0.20201106041742-a1ac97827a27+incompatible github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible diff --git a/go.sum b/go.sum index 002eeb21f5..e232bce447 100644 --- a/go.sum +++ b/go.sum @@ -690,8 +690,8 @@ github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8 h1:M+DNpOu/I3uDmwee6vc github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/parser v0.0.0-20190506092653-e336082eb825/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= github.com/pingcap/parser v0.0.0-20200422082501-7329d80eaf2c/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= -github.com/pingcap/parser v0.0.0-20201203152619-33293d112894 h1:l3j4Ys9EkfvfE89Xylowoe9ncPy/0ajUtZs3MiQphac= -github.com/pingcap/parser v0.0.0-20201203152619-33293d112894/go.mod h1:GbEr2PgY72/4XqPZzmzstlOU/+il/wrjeTNFs6ihsSE= +github.com/pingcap/parser v0.0.0-20201222091346-02c8ff27d0bc h1:oMXIY64IM3ie/sJSnR3aGs7YdyWs4sman+8CLiZOgec= +github.com/pingcap/parser v0.0.0-20201222091346-02c8ff27d0bc/go.mod h1:GbEr2PgY72/4XqPZzmzstlOU/+il/wrjeTNFs6ihsSE= github.com/pingcap/pd v2.1.5+incompatible/go.mod h1:nD3+EoYes4+aNNODO99ES59V83MZSI+dFbhyr667a0E= github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200422143320-428acd53eba2/go.mod h1:s+utZtXDznOiL24VK0qGmtoHjjXNsscJx3m1n8cC56s= github.com/pingcap/sysutil v0.0.0-20200206130906-2bfa6dc40bcd/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI=