Bug #21412 mysql cmdline client allows backslash(es) as delimiter but can't recognize them
Submitted: 2 Aug 2006 13:16 Modified: 14 Dec 2006 4:38
Reporter: Andrey Hristov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1\5.0 OS:Linux (Linux\Windows)
Assigned to: Jay Pipes CPU Architecture:Any

[2 Aug 2006 13:16] Andrey Hristov
Description:
Setting of a delimiter like 
- /
- //
- ///
... is allowed but later unusable when sending query to the server.

How to repeat:
mysql> select version();
+------------------------------------+
| version()                          |
+------------------------------------+
| 5.1.12-beta-valgrind-max-debug-log |
+------------------------------------+
1 row in set (0.01 sec)

mysql> delimiter /
mysql> select 1/
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.01 sec)

mysql> delimiter \
mysql> select 1\
    -> \c
mysql> delimiter \\
mysql> select 1 \\
ERROR:
Unknown command '\\'.
    -> \c
mysql> select 1 \\\
ERROR:
Unknown command '\\'.
    -> \c
mysql> select 1 \\\\
ERROR:
Unknown command '\\'.
ERROR:
Unknown command '\\'.
    -> \c
mysql> delimiter \
mysql> select 1\\
ERROR:
Unknown command '\\'.
    -> \c

Suggested fix:
If not possible to use them, then disable any number of backslashes in the delimiter
[2 Aug 2006 13:27] MySQL Verification Team
Thank you for the bug report.

mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.0.25-debug | 
+--------------+
1 row in set (0.02 sec)

mysql> delimiter /
mysql> select 1/
+---+
| 1 |
+---+
| 1 | 
+---+
1 row in set (0.00 sec)

mysql> delimiter \
mysql> select 1\
    -> \c
mysql> delimiter \\
mysql> select 1 \\
ERROR: 
Unknown command '\\'.
    -> \c
mysql>
[2 Oct 2006 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/12951

ChangeSet@1.2288, 2006-10-02 11:45:48-04:00, jpipes@shakedown.(none) +4 -0
  Fix for Bug #21412 (client allows DELIMITER with backslash character)
[4 Oct 2006 23:45] 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/13098

ChangeSet@1.2323, 2006-10-04 19:45:31-04:00, jpipes@shakedown.(none) +3 -0
  Bug #21412: mysql cmdline client allows backslashes 
  as delimiter but can't recognize them
  
  Added checks in client/mysql.cc for get_one_option() and com_delimiter() to ensure
  a backslash could not be used in the delimiter string.
[14 Dec 2006 4:38] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix for 5.0.32 and 5.1.15.