Bug #38158 mysql client regression, can't read dump files
Submitted: 16 Jul 2008 1:48 Modified: 23 Jul 2008 1:56
Reporter: Timothy Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.1.26 OS:Any
Assigned to: Davi Arnaut CPU Architecture:Any
Tags: MySQL, mysqldump, regression, restore

[16 Jul 2008 1:48] Timothy Smith
Description:
Taken from a comment on Bug #33812:

The patch for Bug #33812, which was pushed into version 5.1.26-rc, results in a new variant of the bug:

Having an inline comment without any text directly before keyword "DELIMITER" as you will find in mysqldump dump files (see snippet below), execution of such script will result in "... ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 4 ..."

snippet of mysqldump dump file:

--
-- Dumping routines for database 'test'
--
DELIMITER ;;
/*!50003 DROP FUNCTION IF EXISTS `f_TestFunction` */;;

If replacing the client (mysql.exe on my windows xp) with the one of version 5.1.25-rc this bug isn't shown.

How to repeat:
Try to load a dump file using the 'mysql' command from 5.1.26.
[16 Jul 2008 3:57] Valeriy Kravchuk
Verified just as described:

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot -proot -P3310 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.26-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> --
    -> DELIMITER ;;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'DELIM
ITER' at line 2
ERROR:
No query specified

mysql> exit
Bye

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql --version
mysql  Ver 14.14 Distrib 5.1.26-rc, for Win32 (ia32)

C:\Program Files\MySQL\MySQL Server 5.1\bin>cd "..\..\MySQL Server 5.0"\bin

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -proot -P3310 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.26-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> --
    -> DELIMITER ;;
Query OK, 0 rows affected (0.00 sec)
[16 Jul 2008 21:29] Jim Winstead
Now I guess we discover why some of that extra code for handling 'delimiter' was there. If you try the same thing with the built-in 'status' command, you will notice that it fails on a line after a comment in both older and the most recent version of 5.1.

Even more interesting, if you do the same thing with 'use', the mysql client loses track of what the current database is:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14701892
Server version: 5.1.23-rc-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> prompt \d>
PROMPT set to '\d>'
(none)>use test 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
test>--
    -> use mysql;
Query OK, 0 rows affected (0.00 sec)

test>select database();
+------------+
| database() |
+------------+
| mysql      | 
+------------+
1 row in set (0.00 sec)

test>

This needs to get fixed more generally, so built-in commands aren't hobbled by a comment on the preceding line.
[17 Jul 2008 18:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/49962

2665 Davi Arnaut	2008-07-17
      Bug#33812: mysql client incorrectly parsing DELIMITER
      
      Revert fix for this bug as it introduced a regression
      reported in Bug#38158.
[17 Jul 2008 18:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/49965

2665 Davi Arnaut	2008-07-17
      Bug#33812: mysql client incorrectly parsing DELIMITER
      
      Revert fix for this bug as it introduced a regression
      reported in Bug#38158.
[17 Jul 2008 23:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/49987

2581 Davi Arnaut	2008-07-17
      Bug#33812: mysql client incorrectly parsing DELIMITER
      
      Revert fix for this bug as it introduced a regression
      reported in Bug#38158.
[17 Jul 2008 23:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/49988

2581 Davi Arnaut	2008-07-17
      Bug#33812: mysql client incorrectly parsing DELIMITER
      
      Revert fix for this bug as it introduced a regression
      reported in Bug#38158.
[18 Jul 2008 22:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/50064

2673 Timothy Smith	2008-07-18
      Cherry-pick fix for Bug #38158 from 6.0-bugteam into 6.0.6-release.
[18 Jul 2008 22:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/50065

2673 Timothy Smith	2008-07-18
      Cherry-pick fix for Bug #38158 from 6.0-bugteam into 6.0.6-release.
[21 Jul 2008 9:36] Bugs System
Pushed into 6.0.6-alpha
[23 Jul 2008 1:56] Paul DuBois
Noted in 5.0.67, 5.1.27, 6.0.6 changelogs.

The fix for Bug#33812 had the side effect of causing the mysql client
not to be able to read some dump files produced with mysqldump. To
address this, that fix was reverted.
[23 Jul 2008 13:08] Bugs System
Pushed into 6.0.7-alpha  (revid:serg@mysql.com-20080722121106-wy84j0yvceyu72zr) (pib:2)
[13 Sep 2008 22:17] Bugs System
Pushed into 6.0.6-alpha  (revid:timothy.smith@sun.com-20080718225026-3mioabh14z9g98a3) (version source revid:hakan@mysql.com-20080716105246-eg0utbybp122n2w9) (pib:3)
[17 Jun 2009 19:25] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version source revid:joro@sun.com-20090515134506-5mq3a8fafgbkx6u1) (merge vers: 6.0.12-alpha) (pib:11)
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 2009 13:48] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 2009 16:33] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)