Justin Swanhart ([info]swanhart) wrote,
@ 2008-07-17 10:27:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
CentOS 5 users beware - The shipped mysql client is broken
CentOS 5 ships with version 5.0.22 of MySQL, which has a number of issues, but I discovered a major one that I wasn't aware of until yesterday. There is a problem in the 5.0.22 client that causes empty strings, or strings consisting only of spaces to be displayed as NULL:
http://bugs.mysql.com/bug.php?id=19564

CREATE TABLE test.x1 (c char(10)) ENGINE=MYISAM;
INSERT INTO test.x1 values (' ');
INSERT INTO test.x1 values ('');


-- on a 5.0.22 client (/usr/local/mysql):
mysql> select * from test.x1;
+------+
| c    |
+------+
| NULL |
| NULL |
+------+
2 rows in set (0.00 sec)

-- on a 5.0.37 client (~/bin/mysql):
mysql> select * from test.x1;
+------+
| c    |
+------+
|      |
|      |
+------+
2 rows in set (0.00 sec)



(Post a new comment)

php-mysql also broken then?
(Anonymous)
2008-07-17 06:23 pm UTC (link)
We noticed that our version of php-mysql coming from Centos 5 was using v. 5.0.22, and we were seeing other issues in that as well.

My first reaction to your post was "Well, I use the RPMs provided by MySQL anyway", but then I thought about the php-mysql thing, and how unfortunate it is that the php folks have decided not to provide linux packages because "most distros come with php these days" see: http://www.php.net/downloads.php sidebar.

(Reply to this) (Thread)

Re: php-mysql also broken then?
[info]swanhart
2008-07-17 08:18 pm UTC (link)
It appears to be only a projection problem in the actual 'mysql' binary (aka the MySQL Monitor) and not in the client libary, so PHP should be safe. I inserted two values into the table, an empty string and NULL.

-- system binary compiled against 5.0.22
[justin@tpchreg1:~]$ /usr/bin/php t.php
'', len:0, null:false
'', len:0, null:true

-- customer binary compiled with 5.1.24-rc
[justin@tpchreg1:~]$ ~/bin/php t.php
'', len:0, null:false
'', len:0, null:true

(Reply to this) (Parent)

What version has the fix?
(Anonymous)
2008-07-17 08:06 pm UTC (link)
Updating to Centos 5.2 brings mysql-5.0.45-7.el5, what version of mysql has this problem been fixed in?

(Reply to this) (Thread)

Re: What version has the fix?
[info]swanhart
2008-07-17 08:16 pm UTC (link)
It is fixed in 5.0.23. Any release after 5.0.22 should not have the problem.

(Reply to this) (Parent)

QA?
(Anonymous)
2008-07-17 08:34 pm UTC (link)
How does something like this happen in production software? Is there no regression tests? Unbelievable.

(Reply to this)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…