Bug #2798 Differing query results in command line than in control centre
Submitted: 14 Feb 2004 14:00 Modified: 16 Feb 2004 9:28
Reporter: Nicola Dunn Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.0.18-max-debug OS:Windows (Windows 2K Advanced Server Editi)
Assigned to: CPU Architecture:Any

[14 Feb 2004 14:00] Nicola Dunn
Description:
Hi.

I've just created a new table and loaded the data using local-infile loading.

The Table is called centres and has three fields; 'name', town, and country
I then typed the following
mysql>SELECT * FROM centres WHERE town = "Manchester";

The following is displayed:

+------------+------------+------------+
|            |            |            |
| name       | town       | country    |
+------------+------------+------------+
     |       |            |            |
     |u Ling | Manchester | UK         |
+------------+------------+------------+
1 row in set (0.00 sec)

However, if I use the Control Center 0.9.4-beta, which I have running at the same time, and execute the same query, it shows the table properly where the name is Kagyu Ling.

Any idea of what's going on here?

Thanks!

How to repeat:
Create a table, load a data set into it. Perform the above query in command line, and in the control centre.
[16 Feb 2004 9:06] MySQL Verification Team
This happens generally when the script or the string value inserted has
\n or \r characters:

C:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-max-nt-log

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

mysql> create table centres (name char(25), town char(25), country char(25));
Query OK, 0 rows affected (0.20 sec)

mysql> insert into centres values ("Kagyu Ling","Manchester","UK");
Query OK, 1 row affected (0.05 sec)

mysql> SELECT * FROM centres WHERE town = "Manchester";
+------------+------------+---------+
| name       | town       | country |
+------------+------------+---------+
| Kagyu Ling | Manchester | UK      |
+------------+------------+---------+
1 row in set (0.01 sec)

mysql> insert into centres values ("Kagyu Ling\n","Manchester","UK");
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM centres WHERE town = "Manchester";
+-------------+------------+---------+
| name        | town       | country |
+-------------+------------+---------+
| Kagyu Ling  | Manchester | UK      |
| Kagyu Ling
 | Manchester | UK      |
+-------------+------------+---------+
2 rows in set (0.03 sec)

Both clients behaves in different ways because the GUI client uses
a grid control with text boxes and the console client just prints
the rows instead.
[16 Feb 2004 9:28] Brian Aker
Just a  behavior question, not a bug. In the future we could perhaps make an option so that line feeds 
are stripped from rows (aka we clean up the way this looks).