Bug #8840 Empty string comparison and character set 'cp1250'
Submitted: 28 Feb 2005 10:20 Modified: 3 Mar 2005 17:05
Reporter: Dusan Pavlica Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.9-nt OS:Windows (Win XP SP2)
Assigned to: Alexander Barkov CPU Architecture:Any

[28 Feb 2005 10:20] Dusan Pavlica
Description:
when using cp1250 then empty CHAR and VARCHAR fields when compared to empty string return 0 and not 1 as expected. Test case is with VARCHAR fields, for CHAR fields it is same.

How to repeat:
CREATE TABLE tb_test (
  t1 varchar(5) NOT NULL default '',
  t2 varchar(5) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_czech_cs;

INSERT INTO tb_test (t1, t2) VALUES('a', '');
INSERT INTO tb_test (t1, t2) VALUES('b', ' ');

SELECT t1, t2, length(t2), t2 = '', t2 = ' ', t2 = '  ' FROM tb_test;

expected output:
t1   t2    length(t2)    t2 = ''    t2 = ' '    t2 = '  '
a            0                1          1           1  
b            0                1          1           1

got output:
t1   t2    length(t2)    t2 = ''    t2 = ' '    t2 = '  '
a            0                0          1           1  
b            0                0          1           1

Suggested fix:
Use different character set ('utf8' - but this doesn't have correct czech collation)
[28 Feb 2005 10:37] Dusan Pavlica
It is a problem of particular collation - 'cp1250_czech_cs' not problem of charset

Dusan Pavlica
[3 Mar 2005 10:20] Alexander Barkov
Fixed in 4.1.11 and 5.0.3
ChangeSet 1.2064
[3 Mar 2005 10:20] 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/22606
[3 Mar 2005 17:05] Paul DuBois
Noted in 4.1.11 changelog.