Description:
Hello,
i have a restore problem in combination with UNION, VIEWS and latin1_german2_ci.
View v_A and v_B select from a Table that inludes a varchar field COLLATE latin1_german2_ci. View v_B select from v_A and v_B with UNION. It works fine for me.
I create a dump and should like to restore that. MySQL tell me: Illegal mix of collations for operation 'UNION'. If I change the COLLATE of the field to latin1_swedish_ci the restore works fine.
But in case of emergency it must work without trouble and any changes!
How to repeat:
mysqldump --disable-keys --triggers --routines -u root -p dumptest > dump.sql
-- MySQL dump 10.13 Distrib 5.5.11, for linux2.6 (x86_64)
--
-- Host: localhost Database: dumptest
-- ------------------------------------------------------
-- Server version 5.5.11-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `myTable`
--
DROP TABLE IF EXISTS `myTable`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `myTable` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`myValue` varchar(20) COLLATE latin1_german2_ci DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `myTable`
--
LOCK TABLES `myTable` WRITE;
/*!40000 ALTER TABLE `myTable` DISABLE KEYS */;
INSERT INTO `myTable` VALUES (1,'Value1'),(2,'Value2');
/*!40000 ALTER TABLE `myTable` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Temporary table structure for view `v_A`
--
DROP TABLE IF EXISTS `v_A`;
/*!50001 DROP VIEW IF EXISTS `v_A`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v_A` (
`ID` int(11),
`myValue` varchar(20)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Temporary table structure for view `v_B`
--
DROP TABLE IF EXISTS `v_B`;
/*!50001 DROP VIEW IF EXISTS `v_B`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v_B` (
`ID` int(11),
`myValue` varchar(20)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Temporary table structure for view `v_Z`
--
DROP TABLE IF EXISTS `v_Z`;
/*!50001 DROP VIEW IF EXISTS `v_Z`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v_Z` (
`ID` int(11),
`myValue` varchar(20)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Dumping routines for database 'dumptest'
--
--
-- Final view structure for view `v_A`
--
/*!50001 DROP TABLE IF EXISTS `v_A`*/;
/*!50001 DROP VIEW IF EXISTS `v_A`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = latin1 */;
/*!50001 SET character_set_results = latin1 */;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`rteubel`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_A` AS select `myTable`.`ID` AS `ID`,`myTable`.`myValue` AS `myValue` from `myTable` where (`myTable`.`ID` = 1) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `v_B`
--
/*!50001 DROP TABLE IF EXISTS `v_B`*/;
/*!50001 DROP VIEW IF EXISTS `v_B`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = latin1 */;
/*!50001 SET character_set_results = latin1 */;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_B` AS select `v_A`.`ID` AS `ID`,`v_A`.`myValue` AS `myValue` from `v_A` union select `v_Z`.`ID` AS `ID`,`v_Z`.`myValue` AS `myValue` from `v_Z` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `v_Z`
--
/*!50001 DROP TABLE IF EXISTS `v_Z`*/;
/*!50001 DROP VIEW IF EXISTS `v_Z`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = latin1 */;
/*!50001 SET character_set_results = latin1 */;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_Z` AS select `myTable`.`ID` AS `ID`,`myTable`.`myValue` AS `myValue` from `myTable` where (`myTable`.`ID` = 2) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;