Bug #15581 COALESCE function truncates mutli-byte TINYTEXT values
Submitted: 8 Dec 2005 10:23 Modified: 13 Jan 2006 0:07
Reporter: Alexander Keremidarski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 and 5.0 OS:Any (any)
Assigned to: Alexander Barkov CPU Architecture:Any

[8 Dec 2005 10:23] Alexander Keremidarski
Description:
COALESCE(utf8_TINYTEXT_column) truncates the ouptut to 85 characters. 

Does not happen with any other TEXT type. 

How to repeat:
mysql> CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
mysql> INSERT INTO t1 VALUES(REPEAT('a', 100));

mysql> CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
Query OK, 1 row affected, 1 warning (0.00 sec)
Records: 1  Duplicates: 0  Warnings: 1

mysql> SHOW WARNINGS;
+---------+------+------------------------------------------+
| Level   | Code | Message                                  |
+---------+------+------------------------------------------+
| Warning | 1265 | Data truncated for column 'bug' at row 1 |
+---------+------+------------------------------------------+
1 row in set (0.00 sec)

mysql> SHOW CREATE TABLE t2;
+-------+-----------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                 |
+-------+-----------------------------------------------------------------------------------------------------------------------+
| t2    | CREATE TEMPORARY TABLE `t2` (
  `bug` char(85) character set utf8 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+---------------------------------------------------------
[19 Dec 2005 11:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/246
[12 Jan 2006 12:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/959
[12 Jan 2006 12:26] Alexander Barkov
Fixed in 4.1.17 and 5.0.19
[13 Jan 2006 0:07] Mike Hillyer
Added to 4.1.17 and 5.0.19 changelogs:

    <listitem>
        <para>
          The <literal>COALESCE()</literal> function truncated data in a
          <literal>TINYTEXT</literal> column. (Bug #15581)
        </para>
      </listitem>