diff options
author | unknown <sanja@montyprogram.com> | 2014-04-10 12:14:18 +0300 |
---|---|---|
committer | unknown <sanja@montyprogram.com> | 2014-04-10 12:14:18 +0300 |
commit | 39afdcddd12858619b648ffaa670021356c3d0c2 (patch) | |
tree | ed5eaeba23027244a55b7703b1e0ad6d0ae8de17 /mysql-test/t/subselect_exists2in.test | |
parent | 584c2d0ae9b509e5fa685180db3e409d2a602e7e (diff) | |
download | mariadb-git-39afdcddd12858619b648ffaa670021356c3d0c2.tar.gz |
MDEV-5401: Wrong result (missing row) on a 2nd execution of PS with exists_to_in=on, MERGE view or a SELECT SQ
The problem was that the view substitute its fields (on prepare) with reverting the change after execution. After prepare on optimization exists2in convertion substituted arguments of '=' with constsnt '1', but then one of the arguments of '=' was reverted to the view field reference.This lead to incorrect WHERE condition on the second execution.
To fix the problem we replace whole '=' with '1' permannently.
Diffstat (limited to 'mysql-test/t/subselect_exists2in.test')
-rw-r--r-- | mysql-test/t/subselect_exists2in.test | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_exists2in.test b/mysql-test/t/subselect_exists2in.test index 94e7109e9d2..9450ef71494 100644 --- a/mysql-test/t/subselect_exists2in.test +++ b/mysql-test/t/subselect_exists2in.test @@ -735,5 +735,30 @@ drop table t1,t2,t3; set optimizer_switch=default; set optimizer_switch='exists_to_in=on'; +--echo # +--echo #MDEV-5401: Wrong result (missing row) on a 2nd execution of PS with +--echo #exists_to_in=on, MERGE view or a SELECT SQ +--echo # +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); + +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2),(3); + +SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a ); + +PREPARE stmt FROM "SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a )"; +EXECUTE stmt; +EXECUTE stmt; + +deallocate prepare stmt; + +drop view v1; +drop table t1,t2; + +--echo # End of 10.0 tests + #restore defaults set optimizer_switch=default; |