Hello.
As of MySQL 4.1, values in CHAR and VARCHAR columns are sorted and compared according to
the
collation of the character set assigned to the column. The reason of that why comparing
with
an empty string gives you 0 layes in your collation. For cp1251_genral_cs it gives correct
results. I think that comparsion of an empty strings shouldn't depend on the 'nationality'
of
the collation and should be the same. So I've reported a bug:
http://bugs.mysql.com/bug.php?id=8815
You may add your comments there. And until it won't be fixed, I suggest you to use another
collation,
or switch to utf8. You may use different values for character_set_client,
character_set_connection,
character_set_resutls system variables to leave a cp1250 character set for clients'
input.
[snip]
Hello,
I have upgraded MySQL from 4.0.7 to 4.1.9 (OS Win XP SP2) and now I have a problem with
empty string comparison.
Test case:
CREATE TABLE tb_test (
t1 char(5) NOT NULL default '',
t2 char(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(t1), length(t2), t2 = '', t2 = ' ', t2 = ' ' FROM tb_test;
output:
t1 t2 length(t1) length(t2) t2 = '' t2 = ' ' t2 = ' '
a 1 0 0 1 1
b 1 0 0 1 1
I don't know why fields with zero length are not equal to empty string. If I change
both
fields t1 and t2 to VARCHAR(5) situation is same.
Could someone help me to solve this out? Maybe I just missed some variable setting or
something like this.
Du?an Pavlica <pavlica@stripped> wrote:
[snip]
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ Gleb.Paharenko@stripped
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com