Bug #60901 5.6.2 client truncates lines at 255 chars/multiline queries dont work on windows
Submitted: 18 Apr 2011 2:32 Modified: 10 Feb 2012 14:17
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S1 (Critical)
Version:5.6.2 OS:Windows
Assigned to: CPU Architecture:Any
Tags: regression

[18 Apr 2011 2:32] Shane Bester
Description:
mysql> select 'a' as a,
    -> 'b' as b;
    '> '
    -> ;
ERROR 1054 (42S22): Unknown column 'mb' in 'field list'

Notice it doesn't know the string is terminated so must be type a quote again!
General query log show it changed the query before sending it:

mysqld, Version: 5.6.2-m5-log (MySQL Community Server (GPL)). started with:
TCP Port: 0, Named Pipe: (null)
Time                 Id Command    Argument
110418  4:11:48	    1 Connect	ODBC@127.0.0.1 as  on 
		    1 Query	select 'a' as a,
mb' as b;
'

How to repeat:
select 'a' as a,
'b' as b;

#Then, you cannot paste this query on 1 one:

select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as a;
[18 Apr 2011 10:29] Valeriy Kravchuk
I've got the following:

C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -uroot -proot -P3314 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.2-m5 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select 'a' as a,
    -> 'b' as b;
+---+---+
| a | b |
+---+---+
| a | b |
+---+---+
1 row in set (0.00 sec)

mysql> select
    -> 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaa'
    -> as a;
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 'a' at
 line 3

The above looks like a bug, as when I execute the same query again:

mysql> select
    -> 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaa'
    -> as a;
+-------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
------------+
| a

            |
+-------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
------------+
| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaa |
+-------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
------------+
1 row in set (0.00 sec)

it works. Please, clarify is everything correct in my test and what exactly is the bug here.
[18 Apr 2011 12:55] MySQL Verification Team
Valeriy, set the console windows properties.
Options: Quick edit=on, Insert mode=on
Font:  Lucida console, size 12.
Layout: Buffer: 500x900, Size: 155,49

I:\mysql\5.6\5.6.2\mysql-5.6.2-m5-win32\bin> chcp
Active code page: 437

After connecting to server the "status" in client should say:
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    cp850
Conn.  characterset:    cp850

It's not intermittently repeatable.  Try copy/paste the how to repeat
by selecting from bottom to top of the testcase, instead of selecting from top to bottom while copying ;)
[18 Apr 2011 16:30] MySQL Verification Team
i tried many queries, multilined, and sometimes the first letter of a next line is spuriously replaced with an 'm' character.  No idea why.
[18 Apr 2011 17:26] MySQL Verification Team
I got same results as Valeriy on Vista 64-bit.
[18 Apr 2011 17:44] MySQL Verification Team
can you cut and paste these queries (dont need tables..) it often fails on the last one: "met names utf8" <-syntax error

Attachment: some_queries.sql (application/octet-stream, text), 690 bytes.

[18 Apr 2011 17:48] MySQL Verification Team
another sample of the leading 'm':

mysql> set optimizer_search_depth=0 ;
Query OK, 0 rows affected (0.03 sec)

mysql> set max_join_size=225723 ;
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 'met max_join_size=225723' at line 1
mysql>
[20 Apr 2011 6:09] MySQL Verification Team
repeatable for me on both machines (xp64, and vista 32).  Vista example:

mysql> select
    -> 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
    -> a;
+------------------------------------------+
| m                                        |
+------------------------------------------+
| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+------------------------------------------+
1 row in set (0.00 sec)

Why is the column called m ?
[20 Apr 2011 6:11] MySQL Verification Team
bug found: that "m" is first letter of "mysql.exe".  I changed it to "sql.exe" and the character appearing became "s".
[20 Apr 2011 6:14] MySQL Verification Team
related: bug #60858
[10 Jun 2011 7:47] MySQL Verification Team
okay, it is not reliable.  just use the 5.6.2 client in your day to day activities with random sql that you run. sooner or later you'll see the 'm' character appear.
[10 Feb 2012 14:17] Paul DuBois
Noted in 5.6.5 changelog.

On Windows, pasting multiple-line input including a CRLF terminator
on the last line into the mysql client resulted in the first
character of the last line being changed, resulting in erroneous
statements.