[MDEV-26362] incorrect nest_level value with INTERSECT Created: 2021-08-13  Updated: 2021-09-08  Resolved: 2021-09-06

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.3
Fix Version/s: 10.3.32

Type: Bug Priority: Blocker
Reporter: Oleksandr Byelkin Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: not-10.2, not-10.4, not-10.5, not-10.6, not-10.7

Issue Links:
Relates

 Description   

If put such assert which shoud be true several tests in the test suite which use INTERSECT will fail:

diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 2b06cf27d9b..93ed007300a 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -7503,6 +7503,10 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
 
   thd->column_usage= column_usage;
   DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage));
+  DBUG_ASSERT(thd->lex->current_select->nest_level >= 0);
+  DBUG_ASSERT(thd->lex->current_select->master_unit()->first_select()
+                ->nest_level ==
+              thd->lex->current_select->nest_level);
   if (allow_sum_func)
     thd->lex->allow_sum_func.set_bit(thd->lex->current_select->nest_level);
   thd->where= THD::DEFAULT_WHERE;


Generated at Thu Feb 08 09:44:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.