diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2019-03-11 18:59:25 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2019-03-12 19:48:16 +0530 |
commit | a4e5888248811e625ad703ee4feb717f37b0e38a (patch) | |
tree | 314b106ddb2b2fe57ec55e874b8b8f0ca541f4e7 /sql/item.cc | |
parent | f72760df3390407c3cbe876e827818bc52849b71 (diff) | |
download | mariadb-git-a4e5888248811e625ad703ee4feb717f37b0e38a.tar.gz |
MDEV-18431: Select max + row_number giving incorrect result
The issue here was when we had a subquery and a window function in an expression in
the select list then subquery was getting computed after window function computation.
This resulted in incorrect results because the subquery was correlated and the fields
in the subquery was pointing to the base table instead of the temporary table.
The approach to fix this was to have an additional field in the temporary table
for the subquery and to execute the subquery before window function execution.
After execution the values for the subquery were stored in the temporary table
and then when we needed to calcuate the expression, all we do is read the values
from the temporary table for the subquery.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index 46420fd2c78..6c9496c9393 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1996,7 +1996,6 @@ void Item::split_sum_func2(THD *thd, Ref_ptr_array ref_pointer_array, } if (unlikely((!(used_tables() & ~PARAM_TABLE_BIT) || - type() == SUBSELECT_ITEM || (type() == REF_ITEM && ((Item_ref*)this)->ref_type() != Item_ref::VIEW_REF)))) return; |