Commit 90aad47d authored by Kentoku SHIBA's avatar Kentoku SHIBA

MDEV-20502 Queries against spider tables return wrong values for columns...

MDEV-20502 Queries against spider tables return wrong values for columns following constant declarations.

Add test cases.
parent af09ce55
...@@ -36,14 +36,38 @@ connection master_1; ...@@ -36,14 +36,38 @@ connection master_1;
SELECT id, 0 AS const, val FROM tbl_a; SELECT id, 0 AS const, val FROM tbl_a;
id const val id const val
1 0 1 1 0 1
SELECT 1+2, id, 0 AS const, val, val+10, (SELECT tbl_a.val+1 FROM tbl_a) AS sq
FROM tbl_a;
1+2 id const val val+10 sq
3 1 0 1 11 2
INSERT INTO tbl_a (val) VALUES (2), (1);
SELECT val+10, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
FROM tbl_a GROUP BY val;
val+10 const val sq
11 0 1 2
12 0 2 2
SELECT MAX(id) AS m, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
FROM tbl_a GROUP BY val;
m const val sq
3 0 1 2
2 0 2 2
connection child2_1; connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument argument
select t0.`id` `id`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 select t0.`id` `id`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0
select t0.`id` `id`,t0.`val` `val`,(t0.`val` + 10) `val+10` from `auto_test_remote`.`tbl_a` t0
select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0
select `id`,`val` from `auto_test_remote`.`tbl_a` order by `id` desc limit 1 for update
select (t0.`val` + 10) `val+10`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 group by t0.`val` order by t0.`val`
select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0 limit 1
select max(t0.`id`) `m`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 group by t0.`val` order by t0.`val`
select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0 limit 1
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT id, val FROM tbl_a ORDER BY id; SELECT id, val FROM tbl_a ORDER BY id;
id val id val
1 1 1 1
2 2
3 1
deinit deinit
connection master_1; connection master_1;
......
...@@ -49,6 +49,13 @@ TRUNCATE TABLE mysql.general_log; ...@@ -49,6 +49,13 @@ TRUNCATE TABLE mysql.general_log;
--connection master_1 --connection master_1
SELECT id, 0 AS const, val FROM tbl_a; SELECT id, 0 AS const, val FROM tbl_a;
SELECT 1+2, id, 0 AS const, val, val+10, (SELECT tbl_a.val+1 FROM tbl_a) AS sq
FROM tbl_a;
INSERT INTO tbl_a (val) VALUES (2), (1);
SELECT val+10, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
FROM tbl_a GROUP BY val;
SELECT MAX(id) AS m, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
FROM tbl_a GROUP BY val;
--connection child2_1 --connection child2_1
eval $CHILD2_1_SELECT_ARGUMENT1; eval $CHILD2_1_SELECT_ARGUMENT1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment