summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-04-23 23:10:46 -0700
committerIgor Babaev <igor@askmonty.org>2019-04-23 23:10:46 -0700
commit5fc8dd8b82e995b3c685f4e71700201097431358 (patch)
tree772a6e25b563f3a25e2088d400c9bac588ddd9c8 /sql/sql_select.cc
parent6b5d3c51b3d4260ba692bb84c64eb2705635e051 (diff)
downloadmariadb-git-5fc8dd8b82e995b3c685f4e71700201097431358.tar.gz
MDEV-17796 WHERE filter is ignored by DISTINCT IFNULL(GROUP_CONCAT(X), Y)
with GROUP BY + ORDER BY The method JOIN::create_postjoin_aggr_table() should not call call JOIN::add_sorting_to_table() unless the first non-constant join table is passed as the first parameter to the method.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c3acdf7415b..3c1cea6be51 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3007,7 +3007,8 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
if (setup_sum_funcs(thd, sum_funcs))
goto err;
- if (!group_list && !table->distinct && order && simple_order)
+ if (!group_list && !table->distinct && order && simple_order &&
+ tab == join_tab + const_tables)
{
DBUG_PRINT("info",("Sorting for order"));
THD_STAGE_INFO(thd, stage_sorting_for_order);