summaryrefslogtreecommitdiff
path: root/sql
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 /sql
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 'sql')
-rw-r--r--sql/item_subselect.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 46d41fd61e3..57dcbd4f540 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1746,7 +1746,7 @@ Item_in_subselect::single_value_transformer(JOIN *join)
Item* join_having= join->having ? join->having : join->tmp_having;
if (!(join_having || select_lex->with_sum_func ||
select_lex->group_list.elements) &&
- select_lex->table_list.elements == 0 &&
+ select_lex->table_list.elements == 0 && !join->conds &&
!select_lex->master_unit()->is_union())
{
Item *where_item= (Item*) select_lex->item_list.head();