summaryrefslogtreecommitdiff
path: root/mysql-test/suite/vcol/r/vcol_select_myisam.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-12-29 15:09:20 -0800
committerIgor Babaev <igor@askmonty.org>2011-12-29 15:09:20 -0800
commit40c42468bcbe215a971f93edb9af27545156b8a7 (patch)
tree864e256a55d6ddde926043e7dfc503d4f75e57b6 /mysql-test/suite/vcol/r/vcol_select_myisam.result
parent5ab628e0240ae280c0b5b03e1d64b2242cd7265e (diff)
downloadmariadb-git-40c42468bcbe215a971f93edb9af27545156b8a7.tar.gz
Fixed LP bug #806057.
A table expression with a natural join or a USING clause is transformed into an equivalent expression with equi-join ON conditions. If a reference to a virtual column happened to occur only in these generated equi-join conditions then it was not erroneously marked in the TABLE::vcol_set bitmap. This could lead to wrong results for queries containing natural join expressions or USING clauses.
Diffstat (limited to 'mysql-test/suite/vcol/r/vcol_select_myisam.result')
-rw-r--r--mysql-test/suite/vcol/r/vcol_select_myisam.result30
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result
index 45e4defd315..04ae7e0f7cd 100644
--- a/mysql-test/suite/vcol/r/vcol_select_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result
@@ -262,3 +262,33 @@ NULL
explain select sum(c) from t1 group by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
+#
+# Bug #806057: join with USING over a virtual column
+#
+CREATE TABLE t1 (b int);
+INSERT INTO t1 VALUES (NULL),( 78), (185), (0), (154);
+CREATE TABLE t2 (a int, b int AS (a) VIRTUAL);
+INSERT INTO t2 VALUES (187,187), (9,9), (187,187);
+Warnings:
+Warning 1647 The value specified for computed column 'b' in table 't2' ignored
+Warning 1647 The value specified for computed column 'b' in table 't2' ignored
+Warning 1647 The value specified for computed column 'b' in table 't2' ignored
+EXPLAIN EXTENDED
+SELECT * FROM t1 JOIN t2 USING (b);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer
+Warnings:
+Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`b` = `test`.`t2`.`b`)
+SELECT * FROM t1 JOIN t2 USING (b);
+b a
+EXPLAIN EXTENDED
+SELECT * FROM t1 NATURAL JOIN t2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer
+Warnings:
+Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`b` = `test`.`t2`.`b`)
+SELECT * FROM t1 NATURAL JOIN t2;
+b a
+DROP TABLE t1,t2;