diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2022-01-22 16:51:21 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2022-01-22 22:23:13 +0530 |
commit | 5e04903f592bb425d52f9fa18388e1e64b67497f (patch) | |
tree | 8f4a08658455c4759eacb21c9de3c53238ab6c8a /sql/sql_base.cc | |
parent | 5e6fd4e80435ae6d5994abbff6032c7957713410 (diff) | |
download | mariadb-git-bb-10.7-MDEV-26843.tar.gz |
MDEV-26843: Inconsistent behavior of ROW_NUMBER upon resignalling frombb-10.7-MDEV-26843
function
Analysis: m_current_row_for_warning is reset to 0 earlier so new value '0'
of the counter gets recorded for error condition.
Fix: reset m_current_row_for_warning after other error conditions.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 414bb5efa25..5bde1ea9232 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -7645,7 +7645,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields, bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, List<Item> &fields, enum_column_usage column_usage, List<Item> *sum_func_list, List<Item> *pre_fix, - bool allow_sum_func) + bool allow_sum_func, bool reset_counter) { Item *item; enum_column_usage saved_column_usage= thd->column_usage; @@ -7669,6 +7669,8 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, DBUG_ASSERT(thd->lex->current_select->master_unit()->first_select() ->nest_level == thd->lex->current_select->nest_level); + if (reset_counter) + thd->get_stmt_da()->reset_current_row_for_warning(1); if (allow_sum_func) thd->lex->allow_sum_func.set_bit(thd->lex->current_select->nest_level); thd->where= THD::DEFAULT_WHERE; @@ -7749,6 +7751,8 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, thd->lex->allow_sum_func= save_allow_sum_func; thd->column_usage= saved_column_usage; + if (reset_counter) + thd->get_stmt_da()->reset_current_row_for_warning(0); DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage)); DBUG_RETURN(MY_TEST(thd->is_error())); } @@ -7770,7 +7774,7 @@ int setup_returning_fields(THD* thd, TABLE_LIST* table_list) return setup_wild(thd, table_list, thd->lex->returning()->item_list, NULL, thd->lex->returning(), true) || setup_fields(thd, Ref_ptr_array(), thd->lex->returning()->item_list, - MARK_COLUMNS_READ, NULL, NULL, false); + MARK_COLUMNS_READ, NULL, NULL, false, 0); } |