diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2020-07-16 22:15:55 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2020-07-27 01:25:49 +0530 |
commit | cf72e969094ef8bde3cb88bc0575abd9a7f4a910 (patch) | |
tree | 2bea4c9ea3897d57423895e9fe704a3469d69506 | |
parent | 5f1ec5cbb78a427ff260888bef5e19daa36b10e2 (diff) | |
download | mariadb-git-bb-10.2-MDEV-14836.tar.gz |
MDEV-14836: Assertion `m_status == DA_ERROR' failed inbb-10.2-MDEV-14836
Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
open_normal_and_derived_table() fails because the query was already killed
as rows examined by the query are more than the limit. However, this isn't a
real error.
Fix: Check if there is actually an error before calling thd->sql_errno()
and later send a warning in handle_select() if no real error.
-rw-r--r-- | mysql-test/r/information_schema.result | 13 | ||||
-rw-r--r-- | mysql-test/t/information_schema.test | 13 | ||||
-rw-r--r-- | sql/sql_show.cc | 18 |
3 files changed, 38 insertions, 6 deletions
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 2d404aff6bc..7644ff4e7a2 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -2184,3 +2184,16 @@ SCHEMA_NAME # # End of 10.1 tests # +# +# Start of 10.2 Test +# +# MDEV-14836: Assertion `m_status == DA_ERROR' failed in +# Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED +# +SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION +Warnings: +Warning 1931 Query execution was interrupted. The query examined at least 666 rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete +# +# End of 10.2 Test +# diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 2df105d4653..df00ff26908 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1906,3 +1906,16 @@ SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a' --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # Start of 10.2 Test +--echo # +--echo # MDEV-14836: Assertion `m_status == DA_ERROR' failed in +--echo # Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED +--echo # + +SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10; + +--echo # +--echo # End of 10.2 Test +--echo # diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 18b7e92bca5..5544c765775 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4430,7 +4430,7 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys, Again we don't do this for SHOW COLUMNS/KEYS because of backward compatibility. */ - if (!is_show_fields_or_keys && result && + if (!is_show_fields_or_keys && result && thd->is_error() && (thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE || thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT)) { @@ -5614,15 +5614,21 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS rather than in SHOW COLUMNS */ - push_warning(thd, Sql_condition::WARN_LEVEL_WARN, - thd->get_stmt_da()->sql_errno(), - thd->get_stmt_da()->message()); - thd->clear_error(); + if (thd->is_error()) + { + /* + The the query was aborted because examined rows exceeded limit. + Don't send the warning here. It is done later, in handle_select(). + */ + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + thd->get_stmt_da()->sql_errno(), + thd->get_stmt_da()->message()); + thd->clear_error(); + } res= 0; } DBUG_RETURN(res); } - show_table= tables->table; count= 0; ptr= show_table->field; |