From 49af76ac8a42f6f971a115ee36a5ff6c56bc6dba Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Mon, 1 Oct 2007 20:03:50 +0000 Subject: [PATCH 1/6] Bug#31095: Unexpected NULL constant caused server crash. The Item_func_rollup_const class is used for wrapping constants to avoid wrong result for ROLLUP queries with DISTINCT and a constant in the select list. This class is also used to wrap up a NULL constant but its null_value wasn't set accordingly. This led to a server crash. Now the null_value of an object of the Item_func_rollup_const class is set by its fix_length_and_dec member function. --- mysql-test/r/olap.result | 11 +++++++++++ mysql-test/t/olap.test | 9 +++++++++ sql/item_func.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index 4a54b17316d..a1d66b11f58 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -715,3 +715,14 @@ a SUM(a) 4 4 NULL 14 DROP TABLE t1; +# +# Bug#31095: Unexpected NULL constant caused server crash. +# +create table t1(a int); +insert into t1 values (1),(2),(3); +select count(a) from t1 group by null with rollup; +count(a) +3 +3 +drop table t1; +############################################################## diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index 05934bff492..1ac99d9c39f 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -358,3 +358,12 @@ SELECT * FROM (SELECT a, SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t; DROP TABLE t1; +--echo # +--echo # Bug#31095: Unexpected NULL constant caused server crash. +--echo # +create table t1(a int); +insert into t1 values (1),(2),(3); +select count(a) from t1 group by null with rollup; +drop table t1; +--echo ############################################################## + diff --git a/sql/item_func.h b/sql/item_func.h index 57e33daf0c4..87c9e016df2 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -749,6 +749,8 @@ public: collation= args[0]->collation; max_length= args[0]->max_length; decimals=args[0]->decimals; + /* The item could be a NULL constant. */ + null_value= args[0]->null_value; } }; From 6c8627de497e642ea75f09c259aadd580cb1a094 Mon Sep 17 00:00:00 2001 From: "gkodinov/kgeorge@magare.gmz" <> Date: Tue, 2 Oct 2007 15:36:07 +0300 Subject: [PATCH 2/6] Fixed a valgrind warning with the fix for bug 28702. --- sql/sql_select.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 699c0be4c5b..e5c0b994ecb 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -15493,6 +15493,7 @@ TABLE_LIST::print_index_hint(THD *thd, String *str, List_iterator_fast li(indexes); String *idx; bool first= 1; + int find_length= strlen(primary_key_name); str->append (' '); str->append (hint, hint_length); @@ -15503,8 +15504,15 @@ TABLE_LIST::print_index_hint(THD *thd, String *str, first= 0; else str->append(','); - if (!my_strcasecmp (system_charset_info, idx->c_ptr_safe(), - primary_key_name)) + /* + It's safe to use ptr() here because we compare the length first + and we rely that my_strcasecmp will not access more than length() + chars from the string. See test_if_string_in_list() for similar + implementation. + */ + if (find_length == idx->length() && + !my_strcasecmp (system_charset_info, primary_key_name, + idx->ptr())) str->append(primary_key_name); else append_identifier (thd, str, idx->ptr(), idx->length()); From c6e974226e5de1496437c345e5da716c3602b7f3 Mon Sep 17 00:00:00 2001 From: "gkodinov/kgeorge@magare.gmz" <> Date: Tue, 2 Oct 2007 17:45:49 +0300 Subject: [PATCH 3/6] fixed a warning in the fix for bug 28702 --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e5c0b994ecb..3529de1c28a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -15493,7 +15493,7 @@ TABLE_LIST::print_index_hint(THD *thd, String *str, List_iterator_fast li(indexes); String *idx; bool first= 1; - int find_length= strlen(primary_key_name); + size_t find_length= strlen(primary_key_name); str->append (' '); str->append (hint, hint_length); From e2614270c394cd9942dc32bf0021a1b2d9ce3eeb Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/eagle.(none)" <> Date: Thu, 4 Oct 2007 15:35:45 +0500 Subject: [PATCH 4/6] after merge fix --- client/client_priv.h | 5 +- client/mysqldump.c | 2 +- mysql-test/r/mysqldump.result | 175 ++++++--------------------------- mysql-test/r/view_grant.result | 24 ++--- 4 files changed, 45 insertions(+), 161 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index 1414de2aa67..c205d07c34c 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -80,7 +80,6 @@ enum options_client OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID, OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT, OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, - OPT_WRITE_BINLOG, OPT_MAX_CLIENT_OPTION, - OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_SSL_VERIFY_SERVER_CERT, - OPT_DEBUG_INFO, OPT_ERROR_LOG_FILE, OPT_DUMP_DATE + OPT_WRITE_BINLOG, OPT_DUMP_DATE, + OPT_MAX_CLIENT_OPTION }; diff --git a/client/mysqldump.c b/client/mysqldump.c index 03265fbf5a3..2b463552dd5 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -425,7 +425,7 @@ static struct my_option my_long_options[] = (uchar**) &opt_single_transaction, (uchar**) &opt_single_transaction, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.", - (gptr*) &opt_dump_date, (gptr*) &opt_dump_date, 0, + (uchar**) &opt_dump_date, (uchar**) &opt_dump_date, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"skip-opt", OPT_SKIP_OPTIMIZATION, "Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.", diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 522e6cc1442..c0856314ba5 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -516,7 +516,7 @@ drop database mysqldump_test_db; # --default-character-set=xxx. However, we should dump in UTF8 # if it is explicitely set. CREATE TABLE t1 (a CHAR(10)); -INSERT INTO t1 VALUES (_latin1 'ÄÖÜß'); +INSERT INTO t1 VALUES (_latin1 ''); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -574,7 +574,7 @@ SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES ('Ž™šá'); +INSERT INTO `t1` VALUES (''); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -600,7 +600,7 @@ SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES ('Ž™šá'); +INSERT INTO `t1` VALUES (''); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -1739,11 +1739,11 @@ create table t1 (a text character set utf8, b text character set latin1); insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E); select * from t1; a b -Osnabrück Köln +Osnabrck Kln test.t1: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 select * from t1; a b -Osnabrück Köln +Osnabrck Kln drop table t1; # # BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence @@ -3805,6 +3805,28 @@ c1 2 DROP TABLE t1,t2; # +# Bug#29815: new option for suppressing last line of mysqldump: +# "Dump completed on" +# +# --skip-dump-date: +-- + + + +-- Dump completed +# --dump-date: +-- + + + +-- Dump completed on DATE +# --dump-date (default): +-- + + + +-- Dump completed on DATE +# # End of 5.0 tests # drop table if exists t1; @@ -3848,145 +3870,6 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; - `a` int(11) default NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`); -SET character_set_client = @saved_cs_client; -DROP TABLE IF EXISTS `t2`; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -CREATE TABLE `t2` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -SET character_set_client = @saved_cs_client; - -LOCK TABLES `t2` WRITE; -/*!40000 ALTER TABLE `t2` DISABLE KEYS */; -/*!40000 ALTER TABLE `t2` ENABLE KEYS */; -UNLOCK TABLES; -DROP TABLE IF EXISTS `t3`; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -CREATE TABLE `t3` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -SET character_set_client = @saved_cs_client; - -LOCK TABLES `t3` WRITE; -/*!40000 ALTER TABLE `t3` DISABLE KEYS */; -/*!40000 ALTER TABLE `t3` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -DROP TABLE t1, t2, t3; -# -# Bug #23491: MySQLDump prefix function call in a view by database name -# -create database bug23491_original; -create database bug23491_restore; -use bug23491_original; -create table t1 (c1 int); -create view v1 as select * from t1; -create procedure p1() select 1; -create function f1() returns int return 1; -create view v2 as select f1(); -create function f2() returns int return f1(); -create view v3 as select bug23491_original.f1(); -use bug23491_restore; -show create view bug23491_restore.v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `f1`() AS `f1()` -show create view bug23491_restore.v3; -View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()` -drop database bug23491_original; -drop database bug23491_restore; -use test; -# -# Bug 27293: mysqldump crashes when dumping routines -# defined by a different user -# -# Bug #22761: mysqldump reports no errors when using -# --routines without mysql.proc privileges -# -create database mysqldump_test_db; -grant all privileges on mysqldump_test_db.* to user1; -grant all privileges on mysqldump_test_db.* to user2; -create procedure mysqldump_test_db.sp1() select 'hello'; - -/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; -DELIMITER ;; - --- insufficient privileges to SHOW CREATE PROCEDURE `sp1` --- does user2 have permissions on mysql.proc? - -DELIMITER ; - -/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; -DELIMITER ;; -/*!50003 SET SESSION SQL_MODE=""*/;; -/*!50003 CREATE*/ /*!50020 DEFINER=`user1`@`%`*/ /*!50003 PROCEDURE `sp1`() -select 'hello' */;; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;; -DELIMITER ; -drop procedure sp1; -drop user user1; -drop user user2; -drop database mysqldump_test_db; -# -# Bug #28522: buffer overrun by '\0' byte using --hex-blob. -# -CREATE TABLE t1 (c1 INT, c2 LONGBLOB); -INSERT INTO t1 SET c1=11, c2=REPEAT('q',509); -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -CREATE TABLE `t1` ( - `c1` int(11) default NULL, - `c2` longblob -); -SET character_set_client = @saved_cs_client; -INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171); -DROP TABLE t1; -# -# Bug #28524: mysqldump --skip-add-drop-table is not -# compatible with views -# -CREATE VIEW v1 AS SELECT 1; -DROP VIEW v1; -SELECT * FROM v1; -1 -1 -DROP VIEW v1; -# -# Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of -# the SQL_MODE variable after the dumping of triggers. -# -CREATE TABLE t1 (c1 INT); -CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END; -CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); -SET @TMP_SQL_MODE = @@SQL_MODE; -SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO'; -INSERT INTO t2 VALUES (0), (1), (2); -SET SQL_MODE = @TMP_SQL_MODE; -SELECT * FROM t2; -c1 -0 -1 -2 -SELECT * FROM t2; -c1 -0 -1 -2 -DROP TABLE t1,t2; -# create table t1 (a text , b text); create table t2 (a text , b text); insert t1 values ("Duck, Duck", "goose"); @@ -4292,8 +4175,8 @@ DROP DATABASE IF EXISTS mysqldump_test_db; # Create objects. CREATE DATABASE mysqldump_test_db; set names koi8r; -CREATE VIEW mysqldump_test_db.v2 AS SELECT 1 AS ËÏÌÏÎËÁ1; -CREATE VIEW mysqldump_test_db.v1 AS SELECT ËÏÌÏÎËÁ1 FROM mysqldump_test_db.v2; +CREATE VIEW mysqldump_test_db.v2 AS SELECT 1 AS 1; +CREATE VIEW mysqldump_test_db.v1 AS SELECT 1 FROM mysqldump_test_db.v2; set names latin1; # Dump mysqldump_test_db to bug30027.sql. diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 8b4aa894130..c301953f508 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -785,7 +785,7 @@ ALTER VIEW v3 AS SELECT f2 FROM t1; ERROR 42000: Access denied; you need the SUPER privilege for this operation SHOW CREATE VIEW v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci DROP USER u26813@localhost; DROP DATABASE db26813; # @@ -810,24 +810,24 @@ ERROR 42000: Access denied; you need the SUPER privilege for this operation ALTER VIEW v2 AS SELECT f2 FROM t1; ERROR 42000: Access denied; you need the SUPER privilege for this operation SHOW CREATE VIEW v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci ALTER VIEW v1 AS SELECT f2 FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f2` AS `f2` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci ALTER VIEW v2 AS SELECT f2 FROM t1; SHOW CREATE VIEW v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f2` AS `f2` from `t1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci ALTER VIEW v1 AS SELECT f1 FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci ALTER VIEW v2 AS SELECT f1 FROM t1; SHOW CREATE VIEW v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci DROP USER u29908_1@localhost; DROP USER u29908_2@localhost; DROP DATABASE mysqltest_29908; @@ -938,6 +938,8 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VI Warnings: Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +Warnings: +Note 1449 There is no 'no_such'@'user_1' registered SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci From d6e626a61d186e3f7e1b59f8b3d039d667c7a577 Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/eagle.(none)" <> Date: Thu, 4 Oct 2007 16:20:56 +0500 Subject: [PATCH 5/6] Bug#30079 A check for "hidden" I_S tables is flawed added check for hidden I_S tables for 'show columns|keys' commands --- mysql-test/r/information_schema.result | 4 ++++ mysql-test/t/information_schema.test | 9 +++++++++ sql/sql_parse.cc | 7 ++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index cf82cdd31bd..8c1a1e67443 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1386,3 +1386,7 @@ f7 datetime NO NULL f8 datetime YES 2006-01-01 00:00:00 drop table t1; End of 5.0 tests. +show fields from information_schema.TABLE_NAMES; +ERROR 42S02: Unknown table 'TABLE_NAMES' in information_schema +show keys from information_schema.TABLE_NAMES; +ERROR 42S02: Unknown table 'TABLE_NAMES' in information_schema diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index e9a06c7186e..684deef120e 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1089,3 +1089,12 @@ show columns from t1; drop table t1; --echo End of 5.0 tests. + +# +# Bug#30079 A check for "hidden" I_S tables is flawed +# +--error 1109 +show fields from information_schema.TABLE_NAMES; +--error 1109 +show keys from information_schema.TABLE_NAMES; + diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 084bcfc3c76..52f8fe8615f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6427,7 +6427,12 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->table_name); if (!schema_table || (schema_table->hidden && - lex->orig_sql_command == SQLCOM_END)) // not a 'show' command + (lex->orig_sql_command == SQLCOM_END || // not a 'show' command + /* + this check is used for show columns|keys from I_S hidden table + */ + lex->orig_sql_command == SQLCOM_SHOW_FIELDS || + lex->orig_sql_command == SQLCOM_SHOW_KEYS))) { my_error(ER_UNKNOWN_TABLE, MYF(0), ptr->table_name, INFORMATION_SCHEMA_NAME.str); From ce2430bcb6421842be1a5b28509ad70aa51fea1b Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/eagle.(none)" <> Date: Thu, 4 Oct 2007 17:08:59 +0500 Subject: [PATCH 6/6] after merge fix --- sql/sql_parse.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 011ba463b5b..4204e9ec881 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5770,8 +5770,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, /* this check is used for show columns|keys from I_S hidden table */ - lex->orig_sql_command == SQLCOM_SHOW_FIELDS || - lex->orig_sql_command == SQLCOM_SHOW_KEYS))) + lex->sql_command == SQLCOM_SHOW_FIELDS || + lex->sql_command == SQLCOM_SHOW_KEYS))) { my_error(ER_UNKNOWN_TABLE, MYF(0), ptr->table_name, INFORMATION_SCHEMA_NAME.str);