summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2009-04-17 12:41:15 +0500
committerSergey Glukhov <Sergey.Glukhov@sun.com>2009-04-17 12:41:15 +0500
commit4fbfa8db451b10b409eb4dd4ba985552c4a86a95 (patch)
treebaa3d0aa922d5d8c2112b040dcb6ad8f98bbd144
parent2c1add4b4599b70e2f512d704a5a18cf1fbfc446 (diff)
downloadmariadb-git-4fbfa8db451b10b409eb4dd4ba985552c4a86a95.tar.gz
Bug#44151 using handler commands on information_schema tables crashes server
information schema tables are based on internal tmp tables which are removed after each statement execution. So HANDLER comands can not be used with information schema.
-rw-r--r--mysql-test/r/handler.result4
-rw-r--r--mysql-test/t/handler.test8
-rw-r--r--sql/sql_handler.cc8
3 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result
index dc3750e16ea..4906111982f 100644
--- a/mysql-test/r/handler.result
+++ b/mysql-test/r/handler.result
@@ -502,3 +502,7 @@ handler t1_alias READ a next where inexistent > 0;
ERROR 42S22: Unknown column 'inexistent' in 'field list'
handler t1_alias close;
drop table t1;
+USE information_schema;
+HANDLER COLUMNS OPEN;
+ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema
+USE test;
diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test
index 6ef216f6ed2..70d4157a272 100644
--- a/mysql-test/t/handler.test
+++ b/mysql-test/t/handler.test
@@ -460,3 +460,11 @@ handler t1_alias read a next;
handler t1_alias READ a next where inexistent > 0;
handler t1_alias close;
drop table t1;
+
+#
+# Bug#44151 using handler commands on information_schema tables crashes server
+#
+USE information_schema;
+--error ER_WRONG_USAGE
+HANDLER COLUMNS OPEN;
+USE test;
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index c376f1b3d1d..721b365a7b9 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -190,6 +190,14 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
tables->db, tables->table_name, tables->alias,
(int) reopen));
+ if (tables->schema_table)
+ {
+ my_error(ER_WRONG_USAGE, MYF(0), "HANDLER OPEN",
+ INFORMATION_SCHEMA_NAME.str);
+ DBUG_PRINT("exit",("ERROR"));
+ DBUG_RETURN(TRUE);
+ }
+
if (! hash_inited(&thd->handler_tables_hash))
{
/*