Skip to content

Commit be47776

Browse files
author
Dag Wanvik
committed
Bug#35710179: [backport] Mysql server 8.1.0 failed at Item_sum_avg::val_decimal
[ backport: skips added test for hypergraph, which gives wrong result. Fixed on trunk with non-regression patch 5681b52 Bug#35836231: i_main.subquery-bug35710179 fails with hypergraph This can't be backported anyway due to other trunk changes, in addition to non-regression status ] The problem is missing propagation of item properties for the left-hand expression of an IN subquery predicate, which causes a window function to loose its property as a window function, and there is subsequent failure because the code expects a window function later on. The fix is to add that propagation. Change-Id: Iae71684c38727cc6db182b1873ff561c07e35f9d
1 parent 23b81f8 commit be47776

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

sql/item_subselect.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,6 +2538,7 @@ void Item_in_subselect::update_used_tables() {
25382538
Item_subselect::update_used_tables();
25392539
left_expr->update_used_tables();
25402540
used_tables_cache |= left_expr->used_tables();
2541+
add_accum_properties(left_expr);
25412542
}
25422543

25432544
/**

sql/sql_optimizer.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,11 @@ bool JOIN::optimize(bool finalize_access_paths) {
594594
// CreateFramebufferTable->ReplaceMaterializedItems's calls of
595595
// update_used_tables: loses PROP_WINDOW_FUNCTION needed here in next
596596
// execution round
597-
if (m_windows.elements > 0)
598-
for (auto f : *fields) f->update_used_tables();
597+
if (m_windows.elements > 0) {
598+
for (auto f : *fields) {
599+
f->update_used_tables();
600+
}
601+
}
599602
}
600603

601604
sort_by_table = get_sort_by_table(order.order, group_list.order,

0 commit comments

Comments
 (0)