summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorVarun Gupta <varunraiko1803@gmail.com>2018-03-21 01:34:45 +0530
committerVarun Gupta <varunraiko1803@gmail.com>2018-03-21 09:38:56 +0200
commit2dd4e50d5f74451a5f6bf56d1a36bafffcca878c (patch)
treebdebcc6aa52bca19915fa547b1906bd8856a8262 /mysql-test/r
parent69bc3c1976ebcbe116890d9d26305fd2887ed47c (diff)
downloadmariadb-git-2dd4e50d5f74451a5f6bf56d1a36bafffcca878c.tar.gz
MDEV-15555: select from DUAL where false yielding wrong result when in a IN
For the query having an IN subquery with no tables, we were converting the subquery with an expression between the left part and the select list of the subquery . This can give incorrect results when we have a condition in the subquery with a dual table (as this is treated as a no table). The fix is that we don't do this conversion when we have conds in the subquery with a dual table.
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/subselect4.result11
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index d3c63ff9a2f..c20c048b919 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -2498,5 +2498,16 @@ FROM t2 WHERE b <= 'quux' GROUP BY field;
field COUNT(DISTINCT c)
0 1
drop table t1,t2;
+#
+# MDEV-15555: select from DUAL where false yielding wrong result when in a IN
+#
+explain
+SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
+2 IN (SELECT 2 from DUAL WHERE 1 != 1)
+0
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;