Generate Schema Script fails "an item with the same key has already been added"
Posted: Wed 17 Jun 2015 22:50
Whenever I try to generate a schema script I get the error "an item with the same key has already been added", and I have no idea what to do to fix it. This is more of a convenience feature for me because I mostly use mysqldump -d, but it's annoying when I do use it.

The problem seems to happen either before the first function (ie, after the tables), or before the first stored procedure. This is what mysqldump produces there:
I can't see anything that suggests a problem, but obviously something makes DBForge unhappy.

The problem seems to happen either before the first function (ie, after the tables), or before the first stored procedure. This is what mysqldump produces there:
Code: Select all
-- Dumping routines for database 'myalarm'
--
/*!50003 DROP FUNCTION IF EXISTS `NewValidationCode` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `NewValidationCode`() RETURNS char(24) CHARSET utf8
BEGIN
-- from http://forums.devarticles.com/mysql-development-50/random-string-in-mysql-89293.html with lower case added
SET @chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; -- no 1Il or O0 to reduce confusion opportunities
SET @charLen = length(@chars);
SET @randomString = '';
WHILE length(@randomString) < 24 DO
SET @randomString = concat(@randomString, substring(@chars,CEILING(RAND() * @charLen),1));
END WHILE;
RETURN @randomString ;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ActivateInstaller` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ActivateInstaller`(
IN p_installer_id INT(11)
)
BEGIN
UPDATE users SET active=1, deleted=NULL WHERE id=p_installer_id;
END ;;
DELIMITER ;