From e474f7547bcf6ba1cabd322ca90f3d97be73ee62 Mon Sep 17 00:00:00 2001 From: Xingyu Yang Date: Mon, 9 Feb 2026 17:01:13 +0800 Subject: [PATCH] [bugfix] Inconsistent query results when using <=> to compare row data with empty set subquery result --- sql/item_subselect.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index e4466735d8c..c39c0bbdbaf 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -3072,6 +3072,13 @@ bool SubqueryWithResult::exec(THD *thd) { char const *save_where = thd->where; const bool res = unit->execute(thd); thd->where = save_where; + if (item->substype() == Item_subselect::SINGLEROW_SUBS && item->null_value) { + Item_singlerow_subselect *item_singlerow = + down_cast(this->item); + for (uint i = 0; i < item_singlerow->cols(); ++i) { + down_cast(item_singlerow->element_index(i))->store_null(); + } + } return res; } -- 2.43.5