List:Commits« Previous MessageNext Message »
From:bar Date:December 19 2005 11:52am
Subject:bk commit into 4.1 tree (bar:1.2462) BUG#15581
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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.2462 05/12/19 15:52:10 bar@stripped +3 -0
    Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
  field.cc:
    BLOB variations have number-in-bytes limit,
    unlike CHAR/VARCHAR which have number-of-characters limits.
    A tinyblob column can store up to 255 bytes.
    In the case of basic Latin letters (which use 1 byte per character)
    we can store up to 255 characters in a tinyblob column.
    When passing an utf8 tinyblob column as an argument into
    a function (e.g. COALESCE) we need to reserve 3*255 bytes.
    I.e. multiply length in bytes to mbcharlen for the character set.
    Although in reality a tinyblob column can never be 3*255 bytes long,
    we need to set max_length to multiply to make fix_length_and_dec()
    of the function-caller (e.g. COALESCE) calculate the correct max_length
    for the column being created.
  
  ctype_utf8.result, ctype_utf8.test:
    Adding test case.

  sql/field.cc
    1.228 05/12/19 15:28:38 bar@stripped +3 -3
    Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
    BLOB variations have byte limits,
    unlike CHAR/VARCHAR which have number-of-character limits.
    It means tinyblob can store up to 255 bytes.
    All of them can be basic latin letters which use 1 byte
    per character.
    I.e. we can store up to 255 characters in a tinyblob column.
    When passing a tinyblob column as an argument into
    a function (for example COALESCE or CONCAT) we
    need to reserve 3*255 bytes in the case of utf-8.
    I.e. multiply length in bytes to mbcharlen for the
    character set.

  mysql-test/r/ctype_utf8.result
    1.68 05/12/19 15:28:05 bar@stripped +8 -0
    Adding test case.

  mysql-test/t/ctype_utf8.test
    1.70 05/12/19 15:27:57 bar@stripped +10 -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.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-4.1.b15581

--- 1.227/sql/field.cc	2005-10-31 12:24:36 +04:00
+++ 1.228/sql/field.cc	2005-12-19 15:28:38 +04:00
@@ -6949,11 +6949,11 @@
   switch (packlength)
   {
   case 1:
-    return 255;
+    return 255 * field_charset->mbmaxlen;
   case 2:
-    return 65535;
+    return 65535 * field_charset->mbmaxlen;
   case 3:
-    return 16777215;
+    return 16777215 * field_charset->mbmaxlen;
   case 4:
     return (uint32) 4294967295U;
   default:

--- 1.67/mysql-test/r/ctype_utf8.result	2005-10-21 14:40:47 +05:00
+++ 1.68/mysql-test/r/ctype_utf8.result	2005-12-19 15:28:05 +04:00
@@ -1070,3 +1070,11 @@
 1
 2
 drop table t1;
+CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
+INSERT INTO t1 VALUES(REPEAT('a', 100));
+CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
+SELECT LENGTH(bug) FROM t2;
+LENGTH(bug)
+100
+DROP TABLE t2;
+DROP TABLE t1;

--- 1.69/mysql-test/t/ctype_utf8.test	2005-10-21 14:40:42 +05:00
+++ 1.70/mysql-test/t/ctype_utf8.test	2005-12-19 15:27:57 +04:00
@@ -882,4 +882,14 @@
 select distinct char(a) from t1;
 drop table t1;
 
+#
+# Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
+#
+CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
+INSERT INTO t1 VALUES(REPEAT('a', 100));
+CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
+SELECT LENGTH(bug) FROM t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (bar:1.2462) BUG#15581bar19 Dec