Bug #13347 | empty result from query with like and cp1250 charset | ||
---|---|---|---|
Submitted: | 20 Sep 2005 11:13 | Modified: | 31 Oct 2005 19:54 |
Reporter: | [ name withheld ] | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.13-log/5.0 BK source | OS: | Linux (Gentoo Linux mysql-4.1.13-r1, x8) |
Assigned to: | Alexander Barkov | CPU Architecture: | Any |
[20 Sep 2005 11:13]
[ name withheld ]
[20 Sep 2005 12:43]
[ name withheld ]
I think, this problem is related to cp1250 charset. With utf8 charset and collate works fine. CREATE TABLE `test` ( `id` int(11) NOT NULL auto_increment, `str` varchar(32) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `str` (`str`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; mysql> explain select * from test where str like 'a%'; +----+-------------+-------+------+---------------+------+---------+------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+---------------+------+---------+------+------+-------------+ | 1 | SIMPLE | test | ALL | str | NULL | NULL | NULL | 7 | Using where | +----+-------------+-------+------+---------------+------+---------+------+------+-------------+ 1 row in set (0.00 sec) mysql> select * from test where str like 'a%'; +----+---------+ | id | str | +----+---------+ | 1 | a | | 2 | aa | | 3 | aaa | | 4 | aaaa | | 5 | aaaaa | | 6 | aaaaaa | | 7 | aaaaaaa | +----+---------+ 7 rows in set (0.00 sec)
[20 Sep 2005 12:47]
MySQL Verification Team
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.1.15-debug-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SET character_set_client = cp1250; Query OK, 0 rows affected (0.06 sec) mysql> SET character_set_results = cp1250; Query OK, 0 rows affected (0.00 sec) mysql> SET character_set_connection = cp1250; Query OK, 0 rows affected (0.00 sec) mysql> mysql> DROP TABLE IF EXISTS `test`; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> CREATE TABLE `test` ( -> `id` INT AUTO_INCREMENT PRIMARY KEY, -> `str` VARCHAR(32) COLLATE cp1250_czech_cs NOT NULL default '', -> UNIQUE KEY (`str`) -> ); Query OK, 0 rows affected (0.09 sec) mysql> mysql> INSERT INTO `test` VALUES (NULL, 'a'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `test` VALUES (NULL, 'aa'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `test` VALUES (NULL, 'aaa'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `test` VALUES (NULL, 'aaaa'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `test` VALUES (NULL, 'aaaaa'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `test` VALUES (NULL, 'aaaaaa'); Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO `test` VALUES (NULL, 'aaaaaaa'); Query OK, 1 row affected (0.00 sec) mysql> select * from test where str like 'aa%'; Empty set (0.01 sec) mysql> select * from test where str COLLATE cp1250_czech_cs like 'aa%'; +----+---------+ | id | str | +----+---------+ | 2 | aa | | 3 | aaa | | 4 | aaaa | | 5 | aaaaa | | 6 | aaaaaa | | 7 | aaaaaaa | +----+---------+ 6 rows in set (0.00 sec) mysql>
[22 Sep 2005 15:25]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/30224
[25 Oct 2005 9:55]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/31439
[27 Oct 2005 10:54]
Alexander Barkov
Fixed in 4.1.16.
[31 Oct 2005 19:54]
Paul DuBois
Noted in 4.1.16 changelog.