Commit 0e9c8395 authored by bar@mysql.com's avatar bar@mysql.com

Merge mysql.com:/usr/home/bar/mysql-4.1.b15581

into  mysql.com:/usr/home/bar/mysql-5.0
parents 00936e27 45c84d0a
...@@ -1167,3 +1167,11 @@ set @a:=null; ...@@ -1167,3 +1167,11 @@ set @a:=null;
execute my_stmt using @a; execute my_stmt using @a;
a b a b
drop table if exists t1; drop table if exists 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;
...@@ -868,6 +868,16 @@ set names utf8; ...@@ -868,6 +868,16 @@ set names utf8;
select distinct char(a) from t1; select distinct char(a) from t1;
drop table 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 # End of 4.1 tests
# #
......
...@@ -8981,11 +8981,11 @@ uint32 Field_blob::max_length() ...@@ -8981,11 +8981,11 @@ uint32 Field_blob::max_length()
switch (packlength) switch (packlength)
{ {
case 1: case 1:
return 255; return 255 * field_charset->mbmaxlen;
case 2: case 2:
return 65535; return 65535 * field_charset->mbmaxlen;
case 3: case 3:
return 16777215; return 16777215 * field_charset->mbmaxlen;
case 4: case 4:
return (uint32) 4294967295U; return (uint32) 4294967295U;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment