Bug #31060 MySQL CLI parser bug 2
Submitted: 17 Sep 2007 14:49 Modified: 18 Mar 2009 14:23
Reporter: d di (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:any, 5.0.44 OS:Any (Ver 14.12 Distrib 5.0.37, for Win32 (ia32))
Assigned to: Georgi Kodinov CPU Architecture:Any
Tags: qc

[17 Sep 2007 14:49] d di
Description:
After typing ";DELIMITER DELIMITER" in the CLI, it is not possible to exit extended command mode.  (Not sure what the correct terminology is.)

After breaking out of extended command mode with CTRL-C and waiting for a few seconds, the CLI aborts itself with an error message regarding my_thread_global_end().

Example:
=====================================
mysql> ;DELIMITER DELIMITER
ERROR:
No query specified
    -> DELIMITER
    -> ;
    ->     ^C -> Aborted

mysql>
mysql>
mysql> Error in my_thread_global_end(): 1 threads didn't exit
=====================================

How to repeat:
(see issue description)

Suggested fix:
A far out corner case, so the issue itself doesn't really need to be fixed.  But I guess it may point to something generally being wrong with the logic in the CLI's SQL parser.
[18 Sep 2007 4:54] Valeriy Kravchuk
Thank you for a bug report. Verified just as described.
[14 Jan 2008 9:01] Timothy Smith
Workaround: you can break out of it with \c:

mysql> ;delimiter delimiter
ERROR: 
No query specified

    -> delimiter
    -> \c
mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> quit
Bye
[20 Jan 2008 19:22] Ryan McCullough
From this thread:
http://forums.mysql.com/read.php?10,153077,153077#msg-153077

It seems like this is a more widespread issue than is suggested here. I am also seeing this problem when using the libmysql.dll that comes with 5.0.45-community-nt. When I use the libmysql.dll that is distributed with php 5.2.1 (http://www.php.net/get/php-5.2.1-Win32.zip/from/a/mirror), I do not get the my_thread_global_end() error.

I am using MySQLDriverCS from sourceforge.net (http://sf.net/projects/mysqldrivercs).
[15 Feb 2008 19:26] Jim Winstead
The issue with my_thread_global_end() has already been resolved. The remaining issue here is how DELIMITER is handled.
[23 Feb 2009 15:49] 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/67223

2755 Georgi Kodinov	2009-02-23
      Bug #31060: MySQL CLI parser bug 2
        
      There was a problem when a DELIMITER COMMAND is not the first 
      command on the line. I this case an extra line feed was added
      to the glob buffer and this was causing subsequent attempts 
      to enter this delimiter to fail.
      Fixed by not adding a new line to the glob buffer if the 
      command being added is a DELIMITER
     @ client/mysql.cc
        Bug #31060: don't add new line for DELIMITER 
        (when added to the glob buffer)
     @ mysql-test/r/mysqltest.result
        Bug #31060: test case
     @ mysql-test/t/mysqltest.test
        Bug #31060: test case
[23 Feb 2009 15:49] 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/67224

2755 Georgi Kodinov	2009-02-23
      Bug #31060: MySQL CLI parser bug 2
      
      There was a problem when a DELIMITER COMMAND is not the first 
      command on the line. I this case an extra line feed was added
      to the glob buffer and this was causing subsequent attempts 
      to enter this delimiter to fail.
      Fixed by not adding a new line to the glob buffer if the 
      command being added is a DELIMITER
     @ client/mysql.cc
        Bug #31060: Don't add a new line if DELIMTER is added to
        the glob buffer
     @ mysql-test/r/mysqltest.result
        Bug #31060: test case
     @ mysql-test/t/mysqltest.test
        Bug #31060: test case
[24 Feb 2009 13:07] 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/67372

2755 Georgi Kodinov	2009-02-24
      Bug #31060: MySQL CLI parser bug 2
            
      There was a problem when a DELIMITER COMMAND is not the first 
      command on the line. I this case an extra line feed was added
      to the glob buffer and this was causing subsequent attempts 
      to enter this delimiter to fail.
      Fixed by not adding a new line to the glob buffer if the 
      command being added is a DELIMITER
     @ client/mysql.cc
        Bug #31060: Don't add a new line if DELIMTER is added to
        the glob buffer
     @ mysql-test/r/mysql.result
        Bug #31060: test case
     @ mysql-test/t/mysql.test
        Bug #31060: test case
[25 Feb 2009 10:29] 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/67492

2760 Georgi Kodinov	2009-02-24
      Bug #31060: MySQL CLI parser bug 2
            
      There was a problem when a DELIMITER COMMAND is not the first 
      command on the line. I this case an extra line feed was added
      to the glob buffer and this was causing subsequent attempts 
      to enter this delimiter to fail.
      Fixed by not adding a new line to the glob buffer if the 
      command being added is a DELIMITER
     @ client/mysql.cc
        Bug #31060: Don't add a new line if DELIMTER is added to
        the glob buffer
     @ mysql-test/r/mysql.result
        Bug #31060: test case
     @ mysql-test/t/mysql.test
        Bug #31060: test case
[25 Feb 2009 10:29] 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/67493

2761 Georgi Kodinov	2009-02-24
      Bug #31060: MySQL CLI parser bug 2
            
      There was a problem when a DELIMITER COMMAND is not the first 
      command on the line. I this case an extra line feed was added
      to the glob buffer and this was causing subsequent attempts 
      to enter this delimiter to fail.
      Fixed by not adding a new line to the glob buffer if the 
      command being added is a DELIMITER
     @ client/mysql.cc
        Bug #31060: Don't add a new line if DELIMTER is added to
        the glob buffer
     @ mysql-test/r/mysql.result
        Bug #31060: test case
     @ mysql-test/t/mysql.test
        Bug #31060: test case
[9 Mar 2009 14:13] Bugs System
Pushed into 5.0.79 (revid:joro@sun.com-20090309135922-a0di9ebkxoj4d4wv) (version source revid:staale.smedseng@sun.com-20090227160758-td4jot2la75f9zy1) (merge vers: 5.0.79) (pib:6)
[13 Mar 2009 16:41] Paul DuBois
Noted in 5.0.79 changelog.

The mysql client mishandled input parsing if a delimiter command was
not first on the line.

Setting report to NDI pending push into 5.1.x/6.0.x.
[13 Mar 2009 19:04] Bugs System
Pushed into 5.1.33 (revid:joro@sun.com-20090313111355-7bsi1hgkvrg8pdds) (version source revid:kgeorge@mysql.com-20090225093427-ht6cwkpg9t1bdf2l) (merge vers: 5.1.33) (pib:6)
[13 Mar 2009 20:14] Paul DuBois
Noted in 5.1.33 changelog.

Setting report to NDI pending push into 6.0.x.
[18 Mar 2009 13:18] Bugs System
Pushed into 6.0.11-alpha (revid:joro@sun.com-20090318122208-1b5kvg6zeb4hxwp9) (version source revid:kgeorge@mysql.com-20090225100618-0scm41mwuws5qxjb) (merge vers: 6.0.10-alpha) (pib:6)
[18 Mar 2009 14:23] Paul DuBois
Noted in 6.0.11 changelog.
[9 May 2009 16:42] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508100057-30ote4xggi4nq14v) (merge vers: 5.1.33-ndb-6.2.18) (pib:6)
[9 May 2009 17:39] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090508175813-s6yele2z3oh6o99z) (merge vers: 5.1.33-ndb-6.3.25) (pib:6)
[9 May 2009 18:37] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509073226-09bljakh9eppogec) (merge vers: 5.1.33-ndb-7.0.6) (pib:6)