Commit a89259fa authored by unknown's avatar unknown

Merge gleb.loc:/home/uchum/work/bk/5.0-opt-29205

into  gleb.loc:/home/uchum/work/bk/5.0-opt

parents 6a00ce71 db397d16
......@@ -1657,3 +1657,40 @@ colA colB colA colB
1 foo 1 foo
2 foo bar 2 foo bar
DROP TABLE t1, t2;
SELECT 'н1234567890' UNION SELECT _binary '1';
н1234567890
н1234567890
1
SELECT 'н1234567890' UNION SELECT 1;
н1234567890
н1234567890
1
SELECT '1' UNION SELECT 'н1234567890';
1
1
н1234567890
SELECT 1 UNION SELECT 'н1234567890';
1
1
н1234567890
CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8;
CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT);
INSERT INTO t1 (c) VALUES ('н1234567890');
INSERT INTO t2 (b, i) VALUES ('1', 1);
SELECT c FROM t1 UNION SELECT b FROM t2;
c
н1234567890
1
SELECT c FROM t1 UNION SELECT i FROM t2;
c
н1234567890
1
SELECT b FROM t2 UNION SELECT c FROM t1;
b
1
н1234567890
SELECT i FROM t2 UNION SELECT c FROM t1;
i
1
н1234567890
DROP TABLE t1, t2;
......@@ -1338,3 +1338,28 @@ INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
WHERE t1.colA < 3;
DROP TABLE t1, t2;
#
# Bug#29205: truncation of UTF8 values when the UNION statement
# forces collation to the binary charset
#
SELECT 'н1234567890' UNION SELECT _binary '1';
SELECT 'н1234567890' UNION SELECT 1;
SELECT '1' UNION SELECT 'н1234567890';
SELECT 1 UNION SELECT 'н1234567890';
CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8;
CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT);
INSERT INTO t1 (c) VALUES ('н1234567890');
INSERT INTO t2 (b, i) VALUES ('1', 1);
SELECT c FROM t1 UNION SELECT b FROM t2;
SELECT c FROM t1 UNION SELECT i FROM t2;
SELECT b FROM t2 UNION SELECT c FROM t1;
SELECT i FROM t2 UNION SELECT c FROM t1;
DROP TABLE t1, t2;
......@@ -6595,9 +6595,15 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
expansion of the size of the values because of character set
conversions.
*/
if (collation.collation != &my_charset_bin)
{
max_length= max(old_max_chars * collation.collation->mbmaxlen,
display_length(item) / item->collation.collation->mbmaxlen *
display_length(item) /
item->collation.collation->mbmaxlen *
collation.collation->mbmaxlen);
}
else
set_if_bigger(max_length, display_length(item));
break;
}
case REAL_RESULT:
......
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