summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect.test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-07-17 12:31:45 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2019-07-19 18:00:10 +0200
commitf90040fd9ccb99cb4541d181a7052c37dc38decb (patch)
tree95a9b6d092ba63de4740105c8a2cdfae206e2256 /mysql-test/t/subselect.test
parentcc86a0bd11a436dfe4df0622481c571f83b1680a (diff)
downloadmariadb-git-bb-5.5-MDEV-19429.tar.gz
MDEV-19429: Wrong query result with EXISTS and LIMIT 0bb-5.5-MDEV-19429
Check EXISTS LIMIT before rewriting.
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r--mysql-test/t/subselect.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 4e35032a789..387935c2d5d 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -6075,4 +6075,28 @@ explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
drop table t1,t2;
+
+--echo #
+--echo # MDEV-19429: Wrong query result with EXISTS and LIMIT 0
+--echo #
+create table t10 (a int);
+insert into t10 values (1),(2),(3);
+create table t12 (a int);
+insert into t12 values (1),(2),(3);
+select * from t10 where exists (select * from t12 order by a limit 0);
+explain select * from t10 where exists (select * from t12 order by a limit 0);
+
+prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)";
+
+set @l=1;
+execute stmt1 using @l;
+set @l=2;
+execute stmt1 using @l;
+set @l=0;
+execute stmt1 using @l;
+
+deallocate prepare stmt1;
+
+drop table t10, t12;
+
--echo End of 5.5 tests