diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-09-26 01:30:36 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-10-06 23:56:06 +0530 |
commit | 479e303ef3e76a984d7885969863157b220c49d0 (patch) | |
tree | 0140a8b3510eff36a199a1159bf59e75711df279 /sql/sql_error.cc | |
parent | 25921c997e5498c9c0bd479528154d0d33b6c09f (diff) | |
download | mariadb-git-479e303ef3e76a984d7885969863157b220c49d0.tar.gz |
MDEV-26606: ROW_NUMBER property value isn't passed from inside a stored
procedure
Analysis: m_current_row_for_warning is reset to 1 during cleanup phase of
stored procedure. When we perform a copy because some statement of procedure
created warning, this reset value is passed to push_warning().
Hence the output is always 1.
Fix: Add a parameter in relevant functions to pass correct value of
row_number and don't use m_current_row_for_warning directly.
Diffstat (limited to 'sql/sql_error.cc')
-rw-r--r-- | sql/sql_error.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 7b6e6a83d2f..a2178831697 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -663,7 +663,8 @@ void Warning_info::reserve_space(THD *thd, uint count) Sql_condition *Warning_info::push_warning(THD *thd, const Sql_condition_identity *value, - const char *msg) + const char *msg, + ulong current_row_number) { Sql_condition *cond= NULL; @@ -673,7 +674,7 @@ Sql_condition *Warning_info::push_warning(THD *thd, m_warn_list.elements() < thd->variables.max_error_count) { cond= new (& m_warn_root) Sql_condition(& m_warn_root, *value, msg, - m_current_row_for_warning); + current_row_number); if (cond) m_warn_list.push_back(cond); } @@ -689,7 +690,8 @@ Sql_condition *Warning_info::push_warning(THD *thd, const Sql_condition *sql_condition) { Sql_condition *new_condition= push_warning(thd, sql_condition, - sql_condition->get_message_text()); + sql_condition->get_message_text(), + sql_condition->m_row_number); if (new_condition) new_condition->copy_opt_attributes(sql_condition); |