List:Commits« Previous MessageNext Message »
From:<gshchepa Date:November 12 2007 9:10pm
Subject:bk commit into 5.0 tree (gshchepa:1.2570) BUG#32282
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum 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, 2007-11-13 01:10:30+04:00, gshchepa@stripped +3 -0
  Fixed bug #32282: TEXT silently truncates when value is exactly 65536
  bytes length.
  
  The server has been modified to report warnings on truncation to
  65536 bytes as usual.

  mysql-test/r/type_blob.result@stripped, 2007-11-13 00:59:31+04:00, gshchepa@stripped +14 -0
    Added test case for bug #32282.

  mysql-test/t/type_blob.test@stripped, 2007-11-13 00:59:19+04:00, gshchepa@stripped +12 -0
    Added test case for bug #32282.

  sql/sql_string.cc@stripped, 2007-11-13 00:59:10+04:00, gshchepa@stripped +3 -0
    Fixed bug #32282.
    The well_formed_copy_nchars function returned an incorrect value
    of copied bytes of the truncated input string: extra length of
    the first truncated character added to the *from_end_pos pointer.
    That has been fixed.

diff -Nrup a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
--- a/mysql-test/r/type_blob.result	2007-03-01 20:59:52 +04:00
+++ b/mysql-test/r/type_blob.result	2007-11-13 00:59:31 +04:00
@@ -807,4 +807,18 @@ set @@sql_mode='TRADITIONAL';
 create table t1 (a text default '');
 ERROR 42000: BLOB/TEXT column 'a' can't have a default value
 set @@sql_mode='';
+CREATE TABLE t (c TEXT CHARSET ASCII);
+INSERT INTO t (c) VALUES (REPEAT('1',65537));
+Warnings:
+Warning	1265	Data truncated for column 'c' at row 1
+INSERT INTO t (c) VALUES (REPEAT('2',65536));
+Warnings:
+Warning	1265	Data truncated for column 'c' at row 1
+INSERT INTO t (c) VALUES (REPEAT('3',65535));
+SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
+LENGTH(c)	CHAR_LENGTH(c)
+65535	65535
+65535	65535
+65535	65535
+DROP TABLE t;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
--- a/mysql-test/t/type_blob.test	2007-02-14 17:44:31 +04:00
+++ b/mysql-test/t/type_blob.test	2007-11-13 00:59:19 +04:00
@@ -436,4 +436,16 @@ set @@sql_mode='TRADITIONAL';
 create table t1 (a text default '');
 set @@sql_mode='';
 
+#
+# Bug #32282: TEXT silently truncates when value is exactly 65536 bytes
+#
+
+CREATE TABLE t (c TEXT CHARSET ASCII);
+INSERT INTO t (c) VALUES (REPEAT('1',65537));
+INSERT INTO t (c) VALUES (REPEAT('2',65536));
+INSERT INTO t (c) VALUES (REPEAT('3',65535));
+SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
+DROP TABLE t;
+
 --echo End of 5.0 tests
+
diff -Nrup a/sql/sql_string.cc b/sql/sql_string.cc
--- a/sql/sql_string.cc	2007-08-07 19:25:43 +05:00
+++ b/sql/sql_string.cc	2007-11-13 00:59:10 +04:00
@@ -997,7 +997,10 @@ outp:
         goto outp;
       }
       else
+      {
+        from= from_prev;
         break;
+      }
     }
     *from_end_pos= from;
     res= to - to_start;
Thread
bk commit into 5.0 tree (gshchepa:1.2570) BUG#32282gshchepa12 Nov
  • Re: bk commit into 5.0 tree (gshchepa:1.2570) BUG#32282Sergei Golubchik19 Nov
    • Re: bk commit into 5.0 tree (gshchepa:1.2570) BUG#32282Gleb Shchepa19 Nov