diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-25 16:09:16 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-25 16:09:16 +0200 |
commit | 3d88f9f34c1223c59272d5086dcd2b4b2cfc167b (patch) | |
tree | 53613cc5f6b07de05a525618c4430149e60f8b86 /sql | |
parent | 01bb003a3a0864c3e7f140816cc681890d0fc988 (diff) | |
parent | 6daf8f8a0d81a1bb7a6241f4363ab9395b14617d (diff) | |
download | mariadb-git-3d88f9f34c1223c59272d5086dcd2b4b2cfc167b.tar.gz |
Merge 10.6 into 10.7
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_subselect.cc | 9 | ||||
-rw-r--r-- | sql/sql_select.cc | 10 |
2 files changed, 9 insertions, 10 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index c2e322926d9..97c7469214d 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -2883,12 +2883,9 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg) { /* The argument list of the top-level AND may change after fix fields. */ and_args= ((Item_cond*) join_arg->conds)->argument_list(); - List_iterator<Item_equal> li(join_arg->cond_equal->current_level); - Item_equal *elem; - while ((elem= li++)) - { - and_args->push_back(elem, thd->mem_root); - } + ((Item_cond_and *) (join_arg->conds))->m_cond_equal= + *join_arg->cond_equal; + and_args->append((List<Item> *)&join_arg->cond_equal->current_level); } } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 721c389d9b6..7d381dd3d18 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -25067,20 +25067,22 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, return 1; } - if (!(*order->item)->with_sum_func()) - continue; - /* UNION queries cannot be used with an aggregate function in an ORDER BY clause */ - if (for_union) + if (for_union && + ((*order->item)->with_sum_func() || + (*order->item)->with_window_func())) { my_error(ER_AGGREGATE_ORDER_FOR_UNION, MYF(0), number); return 1; } + if (!(*order->item)->with_sum_func()) + continue; + if (from_window_spec && (*order->item)->type() != Item::SUM_FUNC_ITEM) (*order->item)->split_sum_func(thd, ref_pointer_array, all_fields, SPLIT_SUM_SELECT); |