diff --git a/mysql-test/main/get_diagnostics.result b/mysql-test/main/get_diagnostics.result index 94ae31d5ee6..090642923ce 100644 --- a/mysql-test/main/get_diagnostics.result +++ b/mysql-test/main/get_diagnostics.result @@ -1598,7 +1598,7 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY' GET DIAGNOSTICS CONDITION 1 @num = ROW_NUMBER, @msg = MESSAGE_TEXT; SELECT @num, @msg; @num @msg -1 Duplicate entry '1' for key 'PRIMARY' +2 Duplicate entry '1' for key 'PRIMARY' DROP PROCEDURE sp; DROP TABLE t1; # Checking more errors diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index 0e0e8921f86..ea669b2d1d8 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -111,15 +111,18 @@ public: /// Text message. char *message; + /** Row number where the condition has happened */ + ulong m_row_number; + /// The constructor. /// /// @param _sql_condition The SQL condition. /// @param arena Query arena for SP - Sql_condition_info(const Sql_condition *_sql_condition, - Query_arena *arena) + Sql_condition_info(const Sql_condition *_sql_condition, Query_arena *arena) :Sql_condition_identity(*_sql_condition) { message= strdup_root(arena->mem_root, _sql_condition->get_message_text()); + m_row_number= _sql_condition->m_row_number; } }; diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc index 6ccc16c53e5..4e86cc4d782 100644 --- a/sql/sql_signal.cc +++ b/sql/sql_signal.cc @@ -441,7 +441,7 @@ bool Sql_cmd_resignal::execute(THD *thd) } Sql_condition signaled_err(thd->mem_root, *signaled, signaled->message, - da->current_row_for_warning()); + signaled->m_row_number); if (m_cond) {