mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
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.
This commit is contained in:
commit
4b0ab1e0dc
4 changed files with 1091 additions and 13 deletions
|
@ -2396,8 +2396,15 @@ 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]);
|
||||
}
|
||||
|
||||
/*
|
||||
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) */;\n"
|
||||
"\n) ENGINE=MyISAM */;\n"
|
||||
"SET character_set_client = @saved_cs_client;\n");
|
||||
|
||||
check_io(sql_file);
|
||||
|
|
|
@ -277,3 +277,16 @@ drop table t3;
|
|||
drop table t4;
|
||||
drop table t5;
|
||||
drop table t6;
|
||||
SELECT @@global.storage_engine INTO @old_engine;
|
||||
SET GLOBAL storage_engine=InnoDB;
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES();
|
||||
SELECT COUNT(*) FROM v1;
|
||||
COUNT(*)
|
||||
1
|
||||
SELECT COUNT(*) FROM v1;
|
||||
COUNT(*)
|
||||
1
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL storage_engine=@old_engine;
|
||||
|
|
|
@ -1999,7 +1999,7 @@ SET @saved_cs_client = @@character_set_client;
|
|||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
|
@ -2096,7 +2096,7 @@ SET @saved_cs_client = @@character_set_client;
|
|||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`a` int(11)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
|
@ -2170,7 +2170,7 @@ SET @saved_cs_client = @@character_set_client;
|
|||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
|
@ -2286,7 +2286,7 @@ SET character_set_client = utf8;
|
|||
`a` int(11),
|
||||
`b` int(11),
|
||||
`c` varchar(30)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
|
@ -2294,7 +2294,7 @@ SET @saved_cs_client = @@character_set_client;
|
|||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` int(11)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
DROP TABLE IF EXISTS `v3`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v3`*/;
|
||||
|
@ -2304,7 +2304,7 @@ SET character_set_client = utf8;
|
|||
`a` int(11),
|
||||
`b` int(11),
|
||||
`c` varchar(30)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
|
@ -3041,7 +3041,7 @@ SET character_set_client = utf8;
|
|||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
`c` varchar(32)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
DROP TABLE IF EXISTS `v1`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
|
@ -3051,7 +3051,7 @@ SET character_set_client = utf8;
|
|||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
`c` varchar(32)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
|
@ -3061,7 +3061,7 @@ SET character_set_client = utf8;
|
|||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
`c` varchar(32)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `test`;
|
||||
|
@ -3441,7 +3441,7 @@ SET @saved_cs_client = @@character_set_client;
|
|||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`id` int(11)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `mysqldump_test_db`;
|
||||
|
@ -3501,7 +3501,7 @@ SET @saved_cs_client = @@character_set_client;
|
|||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `nasishnasifu` (
|
||||
`id` bigint(20) unsigned
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `mysqldump_tables`;
|
||||
|
@ -3959,7 +3959,7 @@ SET @saved_cs_client = @@character_set_client;
|
|||
SET character_set_client = utf8;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`id` int(11)
|
||||
) */;
|
||||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
USE `mysqldump_test_db`;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue