From: Date: January 24 2007 1:37pm Subject: bk commit into 5.0 tree (bar:1.2392) BUG#25815 List-Archive: http://lists.mysql.com/commits/18702 X-Bug: 25815 Message-Id: <200701241237.l0OCbiJw007534@bar.myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.0 repository of bar. When bar 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 1.2392 07/01/24 16:37:38 bar@stripped +3 -0 Bug#25815 Data truncated for column TEXT Problem: "Data truncated" warning was incorrectly generated when storing a Japanese character encoded in utf8 into a cp932 column. Reason: Incorrect wrong warning condition compared the original length of the character in bytes (which is 3 in utf8) to the converted length of the character in bytes (which is 2 in cp932). Fix: use "how many bytes were scanned from input" instead of "how many bytes were put to the column" in the condition. sql/field.cc 1.338 07/01/24 16:37:34 bar@stripped +1 -1 Change warning condition from: "if number of bytes written to destination is less than full source length" to "if number of bytes read from source is less than full source length" mysql-test/t/ctype_cp932.test 1.11 07/01/24 16:37:34 bar@stripped +11 -0 Adding test case mysql-test/r/ctype_cp932.result 1.9 07/01/24 16:37:34 bar@stripped +12 -0 Adding test case # 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: bar # Host: bar.myoffice.izhnet.ru # Root: /home/bar/mysql-5.0.b25815 --- 1.337/sql/field.cc 2006-12-31 00:02:06 +04:00 +++ 1.338/sql/field.cc 2007-01-24 16:37:34 +04:00 @@ -7024,7 +7024,7 @@ cannot_convert_error_pos, from + length)) return 2; - if (copy_length < length) + if (from_end_pos < from + length) { report_data_too_long(this); return 2; --- 1.8/mysql-test/r/ctype_cp932.result 2006-02-24 20:34:07 +04:00 +++ 1.9/mysql-test/r/ctype_cp932.result 2007-01-24 16:37:34 +04:00 @@ -11353,3 +11353,15 @@ a a drop table t1; +set names utf8; +create table t1 (a text) default character set cp932; +insert into t1 values (_utf8 0xE38182); +show warnings; +Level Code Message +select * from t1; +a +あ +select hex(a) from t1; +hex(a) +82A0 +drop table t1; --- 1.10/mysql-test/t/ctype_cp932.test 2006-02-24 20:34:08 +04:00 +++ 1.11/mysql-test/t/ctype_cp932.test 2007-01-24 16:37:34 +04:00 @@ -413,3 +413,14 @@ insert into t1 values ('abc'); select * from t1; drop table t1; + +# +# Bug#25815 Data truncated for column TEXT +# +set names utf8; +create table t1 (a text) default character set cp932; +insert into t1 values (_utf8 0xE38182); +show warnings; +select * from t1; +select hex(a) from t1; +drop table t1;