From 6e162ea9eb01a5e0509ab2b6a6dba31d8f4ba903 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Thu, 11 Sep 2008 07:46:43 +0200 Subject: [PATCH] Bug#31434 mysqldump dumps view as table mysqldump creates stand-in tables before dumping the actual view. Those tables were of the default type; if the view had more columns than that (a pathological case, arguably), loading the dump would fail. We now make the temporary stand-ins MyISAM tables to prevent this. client/mysqldump.c: When creating a stand-in table, specify its type to avoid defaulting to a type with a column-number limit (like Inno). The type is always MyISAM as we know that to be available. mysql-test/r/mysqldump.result: mysqldump sets engine-type (MyISAM) for stand-in tables for views now. Update test results. --- client/mysqldump.c | 8 +++++++- mysql-test/r/mysqldump.result | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 364e80ee56b..ced34f16212 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1836,7 +1836,13 @@ static uint get_table_structure(char *table, char *db, char *table_type, fprintf(sql_file, ",\n %s %s", quote_name(row[0], name_buff, 0), row[1]); } - fprintf(sql_file, "\n) */;\n"); + /* + Stand-in tables are always MyISAM tables as the default + engine might have a column-limit that's lower than the + number of columns in the view, and MyISAM support is + guaranteed to be in the server anyway. + */ + fprintf(sql_file, "\n) ENGINE=MyISAM */;\n"); check_io(sql_file); } } diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index b484cf7c51d..163231c9f66 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1996,7 +1996,7 @@ DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 CREATE TABLE `v2` ( `a` varchar(30) -) */; +) ENGINE=MyISAM */; /*!50001 DROP TABLE `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 CREATE ALGORITHM=UNDEFINED */ @@ -2078,7 +2078,7 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 CREATE TABLE `v1` ( `a` int(11) -) */; +) ENGINE=MyISAM */; /*!50001 DROP TABLE `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 CREATE ALGORITHM=UNDEFINED */ @@ -2140,7 +2140,7 @@ DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 CREATE TABLE `v2` ( `a` varchar(30) -) */; +) ENGINE=MyISAM */; /*!50001 DROP TABLE `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 CREATE ALGORITHM=UNDEFINED */ @@ -2244,19 +2244,19 @@ DROP TABLE IF EXISTS `v1`; `a` int(11), `b` int(11), `c` varchar(30) -) */; +) ENGINE=MyISAM */; DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 CREATE TABLE `v2` ( `a` int(11) -) */; +) ENGINE=MyISAM */; DROP TABLE IF EXISTS `v3`; /*!50001 DROP VIEW IF EXISTS `v3`*/; /*!50001 CREATE TABLE `v3` ( `a` int(11), `b` int(11), `c` varchar(30) -) */; +) ENGINE=MyISAM */; /*!50001 DROP TABLE `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 CREATE ALGORITHM=UNDEFINED */ @@ -2860,21 +2860,21 @@ DROP TABLE IF EXISTS `v0`; `a` int(11), `b` varchar(32), `c` varchar(32) -) */; +) ENGINE=MyISAM */; DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 CREATE TABLE `v1` ( `a` int(11), `b` varchar(32), `c` varchar(32) -) */; +) ENGINE=MyISAM */; DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 CREATE TABLE `v2` ( `a` int(11), `b` varchar(32), `c` varchar(32) -) */; +) ENGINE=MyISAM */; USE `test`; /*!50001 DROP TABLE `v0`*/; @@ -3198,7 +3198,7 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 CREATE TABLE `v1` ( `id` int(11) -) */; +) ENGINE=MyISAM */; USE `mysqldump_test_db`; /*!50001 DROP TABLE `v1`*/; @@ -3246,7 +3246,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHAR USE `mysqldump_views`; /*!50001 CREATE TABLE `nasishnasifu` ( `id` bigint(20) unsigned -) */; +) ENGINE=MyISAM */; USE `mysqldump_tables`;