| Bug #25663 | Simple syntax error confounds MySQL console | ||
|---|---|---|---|
| Submitted: | 17 Jan 2007 2:25 | Modified: | 20 Sep 2007 10:50 |
| Reporter: | Dave Pullin (Basic Quality Contributor) | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.27-community-nt-log, 5.1.14,5.0.36BK | OS: | Windows (Windows 2000) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution | ||
[17 Jan 2007 2:34]
Hakan Küçükyılmaz
Verified on Linux 64-bit running MySQL 5.1.14.
mysql> select replace('john smith' ','\r','R');
ERROR 2005 (HY000): Unknown MySQL server host 'R');' (1)
mysql> select version();
No connection. Trying to reconnect...
ERROR 2005 (HY000): Unknown MySQL server host 'R');' (1)
ERROR:
Can't connect to the server
Thank you for your bug report,
Hakan
[14 Sep 2007 23:53]
Sasha V
fixing parsing char commands - like \*, in mysql client
Attachment: client_parsing_fix.diff (application/octet-stream, text), 9.10 KiB.
[15 Sep 2007 0:10]
Sasha V
patch for version 5.1.23-beta
[15 Sep 2007 22:52]
Sasha V
i've added test and fixed broken, by my previouse patch, handling '\C' - command. Because short-form commands like '\*' are handled regardless to their position in input, and handled BEFORE first operators parsing, errors like this: select \r 1; ERROR 1049 (42000): Unknown database '1;' is possible. Suggested fix: Add position_in_input for short-form commands: ======= these commands must be at the input beginning: -------------------- connect (\r) delimiter (\d) exit (\q) nopager (\n) notee (\t) pager (\P) prompt (\R) quit (\q) rehash (\#) source (\.) status (\s) system (\!) tee (\T) use (\u) warnings (\W) nowarning (\w) edit (\e) these commands can be anywhere in input: -------------------- ego (\G) go (\g) ? (\?) help (\h) print (\p) clear (\c) charset (\C) diffs for today's 5.1.23-beta
[15 Sep 2007 22:53]
Sasha V
diff for client/mysql.cc
Attachment: client_parsing_fix_new.diff (application/octet-stream, text), 9.12 KiB.
[15 Sep 2007 22:53]
Sasha V
diff for main.mysql test
Attachment: test.diff (application/octet-stream, text), 963 bytes.
[20 Sep 2007 10:50]
Chad MILLER
Thank you for taking the time to write to us, but I believe this is not a bug. The simplest case of this is select \r test localhost which does what we expect. Adding two strings before it or putting it inside a function parameter list doesn't change its nature. An unquoted backslash-r always does the same thing, regardless of what comes before it -- it connects the client to a new server+database. mysql> select 'foo'\g select 1\g +-----+ | foo | +-----+ | foo | +-----+ 1 row in set (0.00 sec) +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec) mysql> select '\r'; +---+ | | +---+ | +---+ 1 row in set (0.00 sec) mysql> select 'foo'\r test localhost Connection id: 2 Current database: test mysql> select \r test localhost Connection id: 3 Current database: test

Description: The select select replace('john smith' ','\r','R'); has an extra quote in it. The console log below shows something going weirdly wrong. The session is screwed up thereafter, but the server has NOT crashed. Console log Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2032 to server version: 5.0.27-community-nt-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select replace('john smith' ','\r','R'); ERROR 2005 (HY000): Unknown MySQL server host 'R');' (11001) mysql> select version(); No connection. Trying to reconnect... ERROR 2005 (HY000): Unknown MySQL server host 'R');' (11001) ERROR: Can't connect to the server mysql> How to repeat: select replace('john smith' ','\r','R');