Bug #2043 ORDER BY on utf8 fields causing crash
Submitted: 8 Dec 2003 5:30 Modified: 24 Jan 2004 8:50
Reporter: Dave Jeffery Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1.1-alpha OS:Windows (Windows ME)
Assigned to: MySQL Verification Team CPU Architecture:Any

[8 Dec 2003 5:30] Dave Jeffery
Description:
I'm unable to use utf8, as the MySQL causes my computer to crash if I try doing an ORDER BY for a utf8 text column.

--
Please accept my sincere apologies if this is a known error or due to my system. I have done a search and not seen anything similar.

How to repeat:
From DOS shell:

c:\mysql\bin>mysqld-opt --default-character-set=utf8
c:\mysql\bin>mysql -u root -p --default-character-set=utf8
Enter password:********

From mysql command prompt:

USE test;
CREATE TABLE tbl_test (magyar varchar(20)) DEFAULT CHARACTER SET utf8;
INSERT INTO tbl_test VALUES ("Ótto");
INSERT INTO tbl_test VALUES ("Otto");
INSERT INTO tbl_test VALUES ("Õtto");
INSERT INTO tbl_test VALUES ("Ötto");

SELECT * FROM tbl_test ORDER BY magyar;

MySQL crashes at this point. 

MySQL does not crash if I omit the ORDER BY. 

MySQL does not crash if I sort a table containing utf8 fields on non utf8 fields.
[8 Dec 2003 7:38] MySQL Verification Team
Thank you for the bug report. I tested on Win XP and instead of the crash
I got the mysql client hanging and the server with 99% CPU usage.
[24 Jan 2004 8:50] MySQL Verification Team
Testing against latest 4.1 BK tree, this issue was already fixed:

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

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

mysql> USE test;
Database changed
mysql> CREATE TABLE tbl_test (magyar varchar(20)) DEFAULT CHARACTER SET utf8;
Query OK, 0 rows affected (0.08 sec)

mysql> INSERT INTO tbl_test VALUES ("Ótto");
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO tbl_test VALUES ("Otto");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO tbl_test VALUES ("Õtto");
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO tbl_test VALUES ("Ötto");
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> SELECT * FROM tbl_test ORDER BY magyar;
+--------+
| magyar |
+--------+
| ?tto   |
| Ótto   |
| Õtto   |
| Otto   |
+--------+
4 rows in set (0.01 sec)