Skip to content

Commit 2520830

Browse files
committed
Bug#35710373: mysql server 8.1.0 failed at Item::has_aggregation
The problem is that Item_singlerow_subselect::collect_scalar_subqueries is called with a row subquery when m_collect_unconditionally is true. The function is not prepared for this and thus there is a failure. The fix is to give a return with a false value when called with a row subquery. Change-Id: I7eeb6580ceb6f27dba0b2cb18998e76e63ff416b
1 parent 2cc9320 commit 2520830

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

sql/item_subselect.cc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,16 +2735,17 @@ bool Item_singlerow_subselect::collect_scalar_subqueries(uchar *arg) {
27352735
auto *info = pointer_cast<Collect_scalar_subquery_info *>(arg);
27362736
Item *i = unit->first_query_block()->single_visible_field();
27372737

2738+
// Skip transformations for row subqueries:
2739+
if (i == nullptr) return false;
2740+
27382741
if (!info->m_collect_unconditionally) {
2739-
// Skip transformation if more than one column is selected [1]
2740-
// or column contains a non-deterministic function [3]
2741-
// Also exclude scalar subqueries with references to outer query blocks [2]
2742-
// and Item_maxmin_subselect (ALL/ANY -> MAX/MIN transform artifact) [4]
2742+
// Skip transformation if column contains a non-deterministic function [2]
2743+
// Also exclude scalar subqueries with references to outer query blocks [1]
2744+
// and Item_maxmin_subselect (ALL/ANY -> MAX/MIN transform artifact) [3]
27432745
// Merely correlation to the current query block are ok
2744-
if (i == nullptr || // [1]
2745-
info->is_stopped(this) || is_outer_reference() || // [2]
2746-
is_non_deterministic() || // [3]
2747-
is_maxmin()) { // [4]
2746+
if (info->is_stopped(this) || is_outer_reference() || // [1]
2747+
is_non_deterministic() || // [2]
2748+
is_maxmin()) { // [3]
27482749
return false;
27492750
}
27502751
}

0 commit comments

Comments
 (0)