| Bug #23625 | Admin restore of a function which was backed up gives syntax error | ||
|---|---|---|---|
| Submitted: | 25 Oct 2006 13:04 | Modified: | 25 Oct 2006 19:31 |
| Reporter: | Joe Simone | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Administrator | Severity: | S2 (Serious) |
| Version: | 1.2.4 beta | OS: | Windows (windows XP) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | admin, Backup, error, FUNCTION, restore, SQL, syntax | ||
[25 Oct 2006 16:35]
MySQL Verification Team
Thank you for the bug report. I was able to restore the script you have
provide here with MySQL Administrator:
mysql> show create function localize\G
*************************** 1. row ***************************
Function: localize
sql_mode: NO_AUTO_VALUE_ON_ZERO
Create Function: CREATE DEFINER=`e2m`@`%` FUNCTION `localize`(s text, locale char(5)) RETURNS text CHARSET utf8
begin if (length(rtrim(locale)) = 0) then set locale = 'en_US'; end
if; set @beginTag = concat('[', locale, ']'); set @endtag =
concat('[/', locale, ']'); set @beginIndex = instr(s, @beginTag); set
@endIndex = instr(s, @endTag); if (@beginIndex > 0 && @endIndex > 0) then
return substr(s, @beginIndex + length(@beginTag), @endIndex - @beginIndex -
length(@beginTag)); end if; return s; end
1 row in set (0.00 sec)
[25 Oct 2006 19:31]
Joe Simone
Miguel, You have to use the Query Browser to restore the script. That's where the error is. I have found the admin is unreliable in doing restores so I don't use it --- that's a different bug report! Joe

Description: If I use the 1.2.4 beta admin client to backup a single function, then restore that backup script (using the query browser), I get an error. The error is a SQL syntax error, 1064, on the $$ delimitter. Why would the admin client create a backup script that has an SQL syntax error? The complete single function backup script is provided below. It won't restore sucessfully. Joe How to repeat: -- MySQL Administrator dump 1.4 -- -- ------------------------------------------------------ -- Server version 5.0.26-community-nt /*!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 */; /*!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' */; -- -- Create schema e2m -- CREATE DATABASE /*!32312 IF NOT EXISTS*/ e2m; USE e2m; -- -- Function `e2m`.`localize` -- DROP FUNCTION IF EXISTS `localize`; DELIMITER $$ CREATE DEFINER=`e2m`@`%` FUNCTION `localize`(s text, locale char(5)) RETURNS text CHARSET utf8 begin if (length(rtrim(locale)) = 0) then set locale = 'en_US'; end if; set @beginTag = concat('[', locale, ']'); set @endtag = concat('[/', locale, ']'); set @beginIndex = instr(s, @beginTag); set @endIndex = instr(s, @endTag); if (@beginIndex > 0 && @endIndex > 0) then return substr(s, @beginIndex + length(@beginTag), @endIndex - @beginIndex - length(@beginTag)); end if; return s; end $$ DELIMITER ; /*!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 */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;