From: Date: December 4 2006 1:07am Subject: bk commit into 5.1 tree (petr:1.2390) BUG#21328 List-Archive: http://lists.mysql.com/commits/16359 X-Bug: 21328 Message-Id: <20061204000750.3B5902DF718@outpost.site> Below is the list of changes that have just been committed into a local 5.1 repository of cps. When cps does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2006-12-04 03:07:44+03:00, petr@stripped +4 -0 Fix Bug #21328 mysqld issues warnings on ALTER CSV table to MyISAM mysql-test/r/csv.result@stripped, 2006-12-04 03:07:42+03:00, petr@stripped +8 -0 update result file mysql-test/r/log_tables.result@stripped, 2006-12-04 03:07:42+03:00, petr@stripped +0 -3 log_tables test contains alter of a CSV table with NULLs which results in warnings. In fact this is how the bug noticed. So, now when it is fixed we should update result file. mysql-test/t/csv.test@stripped, 2006-12-04 03:07:42+03:00, petr@stripped +14 -0 add a test for the bug storage/csv/ha_tina.cc@stripped, 2006-12-04 03:07:42+03:00, petr@stripped +4 -2 We should write 0 to the data file in the case we meet NULL. CSV does not support NULL values internally and we shouldn't distinguish them from 0 when writing a row (the alternative is to implement full NULL support). Otherwise other routines (such as Field::check_int() become confused). In 5.0 NULLs are stored as zeroes. In 5.1 it somehow turned into empty string. Which is wrong. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: petr # Host: outpost.site # Root: /home/cps/mysql/trees/5.1-runtime-19044 --- 1.15/mysql-test/r/csv.result 2006-10-17 19:38:06 +04:00 +++ 1.16/mysql-test/r/csv.result 2006-12-04 03:07:42 +03:00 @@ -5223,3 +5223,11 @@ Table Op Msg_type Msg_text test.bug22080_3 check error Corrupt drop tables bug22080_1,bug22080_2,bug22080_3; +CREATE TABLE `bug21328` ( +`col1` int(11) DEFAULT NULL, +`col2` int(11) DEFAULT NULL, +`col3` int(11) DEFAULT NULL +) ENGINE=CSV; +insert into bug21328 values (1,NULL,NULL); +alter table bug21328 engine=myisam; +drop table bug21328; --- 1.18/mysql-test/t/csv.test 2006-11-22 00:15:29 +03:00 +++ 1.19/mysql-test/t/csv.test 2006-12-04 03:07:42 +03:00 @@ -1605,3 +1605,17 @@ check table bug22080_3; drop tables bug22080_1,bug22080_2,bug22080_3; + +# +# Bug #21328 mysqld issues warnings on ALTER CSV table to MyISAM +# + +CREATE TABLE `bug21328` ( + `col1` int(11) DEFAULT NULL, + `col2` int(11) DEFAULT NULL, + `col3` int(11) DEFAULT NULL +) ENGINE=CSV; + +insert into bug21328 values (1,NULL,NULL); +alter table bug21328 engine=myisam; +drop table bug21328; --- 1.69/storage/csv/ha_tina.cc 2006-11-02 03:23:03 +03:00 +++ 1.70/storage/csv/ha_tina.cc 2006-12-04 03:07:42 +03:00 @@ -542,14 +542,16 @@ const char *end_ptr; /* - Write an empty string to the buffer in case of a NULL value. + CSV does not support nulls. Write quoted 0 to the buffer. In fact, + (*field)->val_str(&attribute,&attribute) would usually return 0 + in this case but we write it explicitly here. Basically this is a safety check, as no one ensures that the field content is cleaned up every time we use Field::set_null() in the code. */ if ((*field)->is_null()) { - buffer.append(STRING_WITH_LEN("\"\",")); + buffer.append(STRING_WITH_LEN("\"0\",")); continue; } else --- 1.14/mysql-test/r/log_tables.result 2006-11-27 02:47:22 +03:00 +++ 1.15/mysql-test/r/log_tables.result 2006-12-04 03:07:42 +03:00 @@ -111,9 +111,6 @@ ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' alter table mysql.general_log engine=myisam; alter table mysql.slow_log engine=myisam; -Warnings: -Warning 1366 Incorrect integer value: '' for column 'last_insert_id' at row 0 -Warning 1366 Incorrect integer value: '' for column 'insert_id' at row 0 show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` (