Description:
Using utf8 character set, and short length of varchar, and long expression of like operator, MySQL return no result.
This behavior is same 5.0.22.
How to repeat:
mysql> create table test2 (name varchar(30) not null primary key) engine=InnoDB
default character set utf8;
Query OK, 0 rows affected (0.06 sec)
mysql> insert into test2 (name) values ('あいうえおかきくけこさしすせそ');
Query OK, 1 row affected (0.01 sec)
mysql> select * from test2;
+--------------------------------+
| name |
+--------------------------------+
| あいうえおかきくけこさしすせそ |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select * from test2 where name like 'あいうえおかきくけこさしすせそ';
+--------------------------------+
| name |
+--------------------------------+
| あいうえおかきくけこさしすせそ |
+--------------------------------+
1 row in set (0.00 sec)
mysql> insert into test2 (name) values ('さしすせそかきくけこあいうえお');
Query OK, 1 row affected (0.00 sec)
mysql> select * from test2;
+--------------------------------+
| name |
+--------------------------------+
| あいうえおかきくけこさしすせそ |
| さしすせそかきくけこあいうえお |
+--------------------------------+
2 rows in set (0.00 sec)
mysql> select * from test2 where name like 'さしすせそかきくけこあいうえお%';
Empty set (0.00 sec)
mysql> select * from test2 where name = 'さしすせそかきくけこあいうえお';
+--------------------------------+
| name |
+--------------------------------+
| さしすせそかきくけこあいうえお |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select * from test2 where name like 'あいうえおかきくけこさしすせそ';
Empty set (0.00 sec)
mysql> select * from test2 where name = 'あいうえおかきくけこさしすせそ';
+--------------------------------+
| name |
+--------------------------------+
| あいうえおかきくけこさしすせそ |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select * from test2 where name like 'あいうえおかきくけ%';
+--------------------------------+
| name |
+--------------------------------+
| あいうえおかきくけこさしすせそ |
+--------------------------------+
1 row in set (0.00 sec)
mysql> alter table test2 modify column name varchar(100);
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> select * from test2 where name like 'あいうえおかきくけこさしすせそ';
+--------------------------------+
| name |
+--------------------------------+
| あいうえおかきくけこさしすせそ |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select version();
+------------+
| version() |
+------------+
| 5.0.18-max |
+------------+
1 row in set (0.02 sec)
mysql>
mysql>