=== modified file 'client/mysqldump.c' --- client/mysqldump.c 2007-11-02 08:24:45 +0000 +++ client/mysqldump.c 2008-05-01 21:26:03 +0000 @@ -3776,6 +3776,10 @@ return 1; while ((row= mysql_fetch_row(tableres))) { + if (mysql_get_server_version(mysql) >= 50003 && + !my_strcasecmp(&my_charset_latin1, row[0], "information_schema")) + continue; + if (dump_all_tables_in_db(row[0])) result=1; } @@ -3790,6 +3794,10 @@ } while ((row= mysql_fetch_row(tableres))) { + if (mysql_get_server_version(mysql) >= 50003 && + !my_strcasecmp(&my_charset_latin1, row[0], "information_schema")) + continue; + if (dump_all_views_in_db(row[0])) result=1; } @@ -3896,10 +3904,6 @@ static int init_dumping(char *database, int init_func(char*)) { - if (mysql_get_server_version(mysql) >= 50003 && - !my_strcasecmp(&my_charset_latin1, database, "information_schema")) - return 1; - if (mysql_select_db(mysql, database)) { DB_error(mysql, "when selecting the database"); @@ -3958,6 +3962,7 @@ DBUG_RETURN(1); if (opt_xml) print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS); + if (lock_tables) { DYNAMIC_STRING query; @@ -4191,7 +4196,10 @@ } end= pos; - if (lock_tables) + /* Can't LOCK TABLES in INFORMATION_SCHEMA, so don't try. */ + if (lock_tables && + !(mysql_get_server_version(mysql) >= 50003 && + !my_strcasecmp(&my_charset_latin1, db, "information_schema"))) { if (mysql_real_query(mysql, lock_tables_query.str, lock_tables_query.length-1)) === modified file 'mysql-test/r/mysqldump.result' --- mysql-test/r/mysqldump.result 2007-11-02 08:24:45 +0000 +++ mysql-test/r/mysqldump.result 2008-05-01 21:28:09 +0000 @@ -3574,9 +3574,6 @@ drop table t1; drop user mysqltest_1@localhost; # -# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the -# information_schema database. -# # Bug #21424 mysqldump failing to export/import views # create database mysqldump_myDB; @@ -4231,5 +4228,38 @@ drop database `test-database`; use test; # +# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the +# information_schema database. +# +# Bug #33762: mysqldump can not dump INFORMATION_SCHEMA +# +DROP TABLE IF EXISTS `TABLES`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TEMPORARY TABLE `TABLES` ( + `TABLE_CATALOG` varchar(512) DEFAULT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', + `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', + `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '', + `ENGINE` varchar(64) DEFAULT NULL, + `VERSION` bigint(21) unsigned DEFAULT NULL, + `ROW_FORMAT` varchar(10) DEFAULT NULL, + `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL, + `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL, + `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, + `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, + `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, + `DATA_FREE` bigint(21) unsigned DEFAULT NULL, + `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL, + `CREATE_TIME` datetime DEFAULT NULL, + `UPDATE_TIME` datetime DEFAULT NULL, + `CHECK_TIME` datetime DEFAULT NULL, + `TABLE_COLLATION` varchar(64) DEFAULT NULL, + `CHECKSUM` bigint(21) unsigned DEFAULT NULL, + `CREATE_OPTIONS` varchar(255) DEFAULT NULL, + `TABLE_COMMENT` varchar(80) NOT NULL DEFAULT '' +) ENGINE=MEMORY DEFAULT CHARSET=utf8; +SET character_set_client = @saved_cs_client; +# # End of 5.1 tests # === modified file 'mysql-test/t/mysqldump.test' --- mysql-test/t/mysqldump.test 2007-11-02 08:24:45 +0000 +++ mysql-test/t/mysqldump.test 2008-05-01 21:27:52 +0000 @@ -1357,9 +1357,6 @@ drop user mysqltest_1@localhost; --echo # ---echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the ---echo # information_schema database. ---echo # --echo # Bug #21424 mysqldump failing to export/import views --echo # @@ -1799,6 +1796,13 @@ drop database `test-database`; use test; +--echo # +--echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the +--echo # information_schema database. +--echo # +--echo # Bug #33762: mysqldump can not dump INFORMATION_SCHEMA +--echo # +--exec $MYSQL_DUMP --compact --opt -d information_schema tables --echo # --echo # End of 5.1 tests