summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysqldump.c18
-rw-r--r--mysql-test/r/mysqldump.result36
-rw-r--r--mysql-test/t/mysqldump.test10
3 files changed, 53 insertions, 11 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 323376dd8bf..efcb1820be4 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -3813,6 +3813,10 @@ static int dump_all_databases()
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;
}
@@ -3827,6 +3831,10 @@ static int dump_all_databases()
}
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;
}
@@ -3933,10 +3941,6 @@ int init_dumping_tables(char *qdatabase)
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");
@@ -3995,6 +3999,7 @@ static int dump_all_tables_in_db(char *database)
DBUG_RETURN(1);
if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
+
if (lock_tables)
{
DYNAMIC_STRING query;
@@ -4228,7 +4233,10 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
}
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))
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index c97131563cb..4b658f69371 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -3563,9 +3563,6 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
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;
@@ -3605,6 +3602,39 @@ drop user myDB_User@localhost;
drop database mysqldump_myDB;
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`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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(32) 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
+#
# Bug#19745 mysqldump --xml produces invalid xml
#
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index fe89d7bdafa..34ffbe4372b 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1396,9 +1396,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 #
@@ -1464,6 +1461,13 @@ disconnect root;
--remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql
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 # Bug#19745 mysqldump --xml produces invalid xml