Skip to content

Commit

Permalink
parser: support multi bracket for subquery (#29656)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylzd authored Dec 2, 2021
1 parent 6475e89 commit 2242f9c
Show file tree
Hide file tree
Showing 4 changed files with 4,404 additions and 4,335 deletions.
16 changes: 16 additions & 0 deletions bindinfo/bind_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,22 @@ func TestBindingWithoutCharset(t *testing.T) {
require.Equal(t, "SELECT * FROM `test`.`t` WHERE `a` = 'aa'", rows[0][1])
}

func TestBindingWithMultiParenthesis(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()

tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t (a int)")
tk.MustExec("create global binding for select * from (select * from t where a = 1) tt using select * from (select * from t where a = 1) tt")
tk.MustExec("create global binding for select * from ((select * from t where a = 1)) tt using select * from (select * from t where a = 1) tt")
rows := tk.MustQuery("show global bindings").Rows()
require.Len(t, rows, 1)
require.Equal(t, "select * from ( select * from `test` . `t` where `a` = ? ) as `tt`", rows[0][0])
require.Equal(t, "SELECT * FROM (SELECT * FROM `test`.`t` WHERE `a` = 1) AS `tt`", rows[0][1])
}

func TestGCBindRecord(t *testing.T) {
// set lease for gc tests
originLease := bindinfo.Lease
Expand Down
Loading

0 comments on commit 2242f9c

Please sign in to comment.