From ba774a0a90fac0163babe9d7a964aa36503e1711 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 8 Apr 2026 13:36:26 +0300 Subject: [PATCH] Fix in condition pushdown code: don't pass List by value. Affected functions: find_matching_field_pair(Item *item, List pair_list) get_corresponding_field_pair(Item *item, List pair_list) Both only traverse the pair_list. They use List_iterator so we can't easily switch to using const-reference. --- sql/opt_subselect.cc | 2 +- sql/sql_lex.cc | 2 +- sql/sql_lex.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index f079d3f5b6834..dbacddd91f811 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -6863,7 +6863,7 @@ bool Item::pushable_equality_checker_for_subquery(uchar *arg) NULL if the matching Field_pair wasn't found. */ -Field_pair *find_matching_field_pair(Item *item, List pair_list) +Field_pair *find_matching_field_pair(Item *item, List &pair_list) { Field_pair *field_pair= get_corresponding_field_pair(item, pair_list); if (field_pair) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 43615249ecb90..bf014ff4faedf 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -11310,7 +11310,7 @@ st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond) */ Field_pair *get_corresponding_field_pair(Item *item, - List pair_list) + List &pair_list) { DBUG_ASSERT(item->type() == Item::DEFAULT_VALUE_ITEM || item->type() == Item::FIELD_ITEM || diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 5ce42ae58e5eb..2a5bd56d423d8 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1099,8 +1099,8 @@ class Field_pair :public Sql_alloc }; Field_pair *get_corresponding_field_pair(Item *item, - List pair_list); -Field_pair *find_matching_field_pair(Item *item, List pair_list); + List &pair_list); +Field_pair *find_matching_field_pair(Item *item, List & pair_list); #define TOUCHED_SEL_COND 1/* WHERE/HAVING/ON should be reinited before use */