summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2021-04-26 17:11:51 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2021-04-26 17:11:51 +0530
commitf73166cded0ee5a3b8615d16a0d91dfd8e867dba (patch)
tree21a10d71e7ef63e8a718bfc8540745c1f7167e1b
parent54c460ace606157f2a23706ec98e9de70aba767e (diff)
downloadmariadb-git-bb-10.3-MDEV-25462.tar.gz
MDEV-25462: Assertion `m_status == DA_ERROR || m_status == DA_OK ||bb-10.3-MDEV-25462
m_status == DA_OK_BULK' failed in Diagnostics_area::message from get_schema_tables_record Analysis: When parsing takes place and we get ER_PARSE_ERROR, error is not set because we assume we are parsing a stored procedure. Fix: Set error status if error is ER_PARSE_ERROR and we are not parsing a stored procedure.
-rw-r--r--mysql-test/main/ctype_filename.result30
-rw-r--r--mysql-test/main/ctype_filename.test25
-rw-r--r--sql/sp.cc1
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_show.cc2
6 files changed, 59 insertions, 1 deletions
diff --git a/mysql-test/main/ctype_filename.result b/mysql-test/main/ctype_filename.result
index 2eee5d2888e..8d70950ca31 100644
--- a/mysql-test/main/ctype_filename.result
+++ b/mysql-test/main/ctype_filename.result
@@ -106,3 +106,33 @@ SET NAMES utf8;
#
# End of 10.5 tests
#
+#
+# Beginning of 10.3 test.
+#
+# MDEV-25462: Assertion `m_status == DA_ERROR || m_status == DA_OK ||
+# m_status == DA_OK_BULK' failed in Diagnostics_area::message from
+# get_schema_tables_record
+#
+SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
+@@character_set_client @@character_set_connection @@character_set_results
+utf8 utf8 utf8
+SET @old_character_set_client= @@character_set_client;
+SET @old_character_set_connection= @@character_set_connection;
+SET @old_character_set_results= @@character_set_results;
+SET NAMES 'filename';
+SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
+@@character_set_client @@character_set_connection @@character_set_results
+filename filename filename
+CREATE VIEW v2 AS SELECT 1;
+SHOW TABLE STATUS;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+v2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL You@0020have@0020an@0020error@0020in@0020your@0020SQL@0020syntax@003b@0020check@0020the@0020manual@0020that@0020corresponds@0020to@0020your@0020MariaDB@0020server@0020version@0020for@0020the@0020right@0020syntax@0020to@0020use@0020near@0020@0027@00601@0060@0027@0020at@0020line@00201 NULL NULL
+Warnings:
+Warning 1064 You@0020have@0020an@0020error@0020in@0020your@0020SQL@0020syntax@003b@0020check@0020the@0020manual@0020that@0020corresponds@0020to@0020your@0020MariaDB@0020server@0020version@0020for@0020the@0020right@0020syntax@0020to@0020use@0020near@0020@0027@00601@0060@0027@0020at@0020line@00201
+DROP VIEW v2;
+SET @@character_set_client= @old_character_set_client;
+SET @@character_set_connection= @old_character_set_connection;
+SET @@character_set_results= @old_character_set_results;
+#
+# End of 10.3 test
+#
diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test
index 17ab71e3985..8d7fd477c21 100644
--- a/mysql-test/main/ctype_filename.test
+++ b/mysql-test/main/ctype_filename.test
@@ -118,3 +118,28 @@ SET NAMES utf8;
--echo #
--echo # End of 10.5 tests
--echo #
+
+--echo #
+--echo # Beginning of 10.3 test.
+--echo #
+--echo # MDEV-25462: Assertion `m_status == DA_ERROR || m_status == DA_OK ||
+--echo # m_status == DA_OK_BULK' failed in Diagnostics_area::message from
+--echo # get_schema_tables_record
+--echo #
+
+SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
+SET @old_character_set_client= @@character_set_client;
+SET @old_character_set_connection= @@character_set_connection;
+SET @old_character_set_results= @@character_set_results;
+SET NAMES 'filename';
+SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
+CREATE VIEW v2 AS SELECT 1;
+SHOW TABLE STATUS;
+DROP VIEW v2;
+SET @@character_set_client= @old_character_set_client;
+SET @@character_set_connection= @old_character_set_connection;
+SET @@character_set_results= @old_character_set_results;
+
+--echo #
+--echo # End of 10.3 test
+--echo #
diff --git a/sql/sp.cc b/sql/sp.cc
index ac9203ffb8a..4696ab8f0ae 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -870,6 +870,7 @@ static sp_head *sp_compile(THD *thd, String *defstr, sql_mode_t sql_mode,
thd->lex->sphead= parent;
thd->push_internal_handler(&warning_handler);
thd->spcont= 0;
+ thd->is_parsing_IS_table=true;
if (parse_sql(thd, & parser_state, creation_ctx) || thd->lex == NULL)
{
diff --git a/sql/sql_class.h b/sql/sql_class.h
index c9967b98994..d43b49d56d4 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2814,6 +2814,7 @@ public:
bool create_tmp_table_for_derived;
bool save_prep_leaf_list;
+ bool is_parsing_IS_table;
/* container for handler's private per-connection data */
Ha_data ha_data[MAX_HA];
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 98a437c5991..e4888bee6fd 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -7586,6 +7586,7 @@ void THD::reset_for_next_command(bool do_clear_error)
get_stmt_da()->reset_for_next_command();
rand_used= 0;
m_sent_row_count= m_examined_row_count= 0;
+ is_parsing_IS_table=false;
accessed_rows_and_keys= 0;
reset_slow_query_state();
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 38b3d62d539..7ed4c3b5696 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -5045,7 +5045,7 @@ public:
const char* msg, Sql_condition ** cond_hdl)
{
if (sql_errno == ER_TRG_NO_DEFINER || sql_errno == ER_TRG_NO_CREATION_CTX
- || sql_errno == ER_PARSE_ERROR)
+ || (sql_errno == ER_PARSE_ERROR && thd->is_parsing_IS_table))
return true;
if (*level != Sql_condition::WARN_LEVEL_ERROR)