Commit 6e162ea9 authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

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.
parent 776793a9
...@@ -1836,7 +1836,13 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1836,7 +1836,13 @@ static uint get_table_structure(char *table, char *db, char *table_type,
fprintf(sql_file, ",\n %s %s", fprintf(sql_file, ",\n %s %s",
quote_name(row[0], name_buff, 0), row[1]); 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); check_io(sql_file);
} }
} }
......
...@@ -1996,7 +1996,7 @@ DROP TABLE IF EXISTS `v2`; ...@@ -1996,7 +1996,7 @@ DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` ( /*!50001 CREATE TABLE `v2` (
`a` varchar(30) `a` varchar(30)
) */; ) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2078,7 +2078,7 @@ DROP TABLE IF EXISTS `v1`; ...@@ -2078,7 +2078,7 @@ DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`a` int(11) `a` int(11)
) */; ) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2140,7 +2140,7 @@ DROP TABLE IF EXISTS `v2`; ...@@ -2140,7 +2140,7 @@ DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` ( /*!50001 CREATE TABLE `v2` (
`a` varchar(30) `a` varchar(30)
) */; ) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2244,19 +2244,19 @@ DROP TABLE IF EXISTS `v1`; ...@@ -2244,19 +2244,19 @@ DROP TABLE IF EXISTS `v1`;
`a` int(11), `a` int(11),
`b` int(11), `b` int(11),
`c` varchar(30) `c` varchar(30)
) */; ) ENGINE=MyISAM */;
DROP TABLE IF EXISTS `v2`; DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` ( /*!50001 CREATE TABLE `v2` (
`a` int(11) `a` int(11)
) */; ) ENGINE=MyISAM */;
DROP TABLE IF EXISTS `v3`; DROP TABLE IF EXISTS `v3`;
/*!50001 DROP VIEW IF EXISTS `v3`*/; /*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 CREATE TABLE `v3` ( /*!50001 CREATE TABLE `v3` (
`a` int(11), `a` int(11),
`b` int(11), `b` int(11),
`c` varchar(30) `c` varchar(30)
) */; ) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2860,21 +2860,21 @@ DROP TABLE IF EXISTS `v0`; ...@@ -2860,21 +2860,21 @@ DROP TABLE IF EXISTS `v0`;
`a` int(11), `a` int(11),
`b` varchar(32), `b` varchar(32),
`c` varchar(32) `c` varchar(32)
) */; ) ENGINE=MyISAM */;
DROP TABLE IF EXISTS `v1`; DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`a` int(11), `a` int(11),
`b` varchar(32), `b` varchar(32),
`c` varchar(32) `c` varchar(32)
) */; ) ENGINE=MyISAM */;
DROP TABLE IF EXISTS `v2`; DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` ( /*!50001 CREATE TABLE `v2` (
`a` int(11), `a` int(11),
`b` varchar(32), `b` varchar(32),
`c` varchar(32) `c` varchar(32)
) */; ) ENGINE=MyISAM */;
USE `test`; USE `test`;
/*!50001 DROP TABLE `v0`*/; /*!50001 DROP TABLE `v0`*/;
...@@ -3198,7 +3198,7 @@ DROP TABLE IF EXISTS `v1`; ...@@ -3198,7 +3198,7 @@ DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`id` int(11) `id` int(11)
) */; ) ENGINE=MyISAM */;
USE `mysqldump_test_db`; USE `mysqldump_test_db`;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE `v1`*/;
...@@ -3246,7 +3246,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHAR ...@@ -3246,7 +3246,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHAR
USE `mysqldump_views`; USE `mysqldump_views`;
/*!50001 CREATE TABLE `nasishnasifu` ( /*!50001 CREATE TABLE `nasishnasifu` (
`id` bigint(20) unsigned `id` bigint(20) unsigned
) */; ) ENGINE=MyISAM */;
USE `mysqldump_tables`; USE `mysqldump_tables`;
......
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