Commit e3fa6859 authored by Jim Winstead's avatar Jim Winstead

mysqldump would not dump the INFORMATION_SCHEMA even when it was explicitly

requested. (Bug #33762)
parent 16ef0881
...@@ -3813,6 +3813,10 @@ static int dump_all_databases() ...@@ -3813,6 +3813,10 @@ static int dump_all_databases()
return 1; return 1;
while ((row= mysql_fetch_row(tableres))) 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])) if (dump_all_tables_in_db(row[0]))
result=1; result=1;
} }
...@@ -3827,6 +3831,10 @@ static int dump_all_databases() ...@@ -3827,6 +3831,10 @@ static int dump_all_databases()
} }
while ((row= mysql_fetch_row(tableres))) 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])) if (dump_all_views_in_db(row[0]))
result=1; result=1;
} }
...@@ -3933,10 +3941,6 @@ int init_dumping_tables(char *qdatabase) ...@@ -3933,10 +3941,6 @@ int init_dumping_tables(char *qdatabase)
static int init_dumping(char *database, int init_func(char*)) 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)) if (mysql_select_db(mysql, database))
{ {
DB_error(mysql, "when selecting the database"); DB_error(mysql, "when selecting the database");
...@@ -3995,6 +3999,7 @@ static int dump_all_tables_in_db(char *database) ...@@ -3995,6 +3999,7 @@ static int dump_all_tables_in_db(char *database)
DBUG_RETURN(1); DBUG_RETURN(1);
if (opt_xml) if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS); print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
if (lock_tables) if (lock_tables)
{ {
DYNAMIC_STRING query; DYNAMIC_STRING query;
...@@ -4228,7 +4233,10 @@ static int dump_selected_tables(char *db, char **table_names, int tables) ...@@ -4228,7 +4233,10 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
} }
end= pos; 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, if (mysql_real_query(mysql, lock_tables_query.str,
lock_tables_query.length-1)) lock_tables_query.length-1))
......
...@@ -3563,9 +3563,6 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; ...@@ -3563,9 +3563,6 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; 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 # Bug#21424 mysqldump failing to export/import views
# #
create database mysqldump_myDB; create database mysqldump_myDB;
...@@ -3605,6 +3602,39 @@ drop user myDB_User@localhost; ...@@ -3605,6 +3602,39 @@ drop user myDB_User@localhost;
drop database mysqldump_myDB; drop database mysqldump_myDB;
use test; 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 # Bug#19745 mysqldump --xml produces invalid xml
# #
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
......
...@@ -1395,9 +1395,6 @@ drop table t1; ...@@ -1395,9 +1395,6 @@ drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
--echo #
--echo # Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the
--echo # information_schema database.
--echo # --echo #
--echo # Bug#21424 mysqldump failing to export/import views --echo # Bug#21424 mysqldump failing to export/import views
--echo # --echo #
...@@ -1464,6 +1461,13 @@ disconnect root; ...@@ -1464,6 +1461,13 @@ disconnect root;
--remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql --remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql
use test; 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 #
--echo # Bug#19745 mysqldump --xml produces invalid xml --echo # Bug#19745 mysqldump --xml produces invalid xml
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment