3488 Sergey Glukhov 2011-10-12 [merge]
automerge
3487 Sergey Glukhov 2011-10-12 [merge]
automerge
modified:
storage/innobase/btr/btr0cur.c
storage/innobase/btr/btr0sea.c
storage/innobase/buf/buf0buf.c
storage/innobase/buf/buf0lru.c
storage/innobase/ha/ha0ha.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/i_s.cc
storage/innobase/ibuf/ibuf0ibuf.c
storage/innobase/include/btr0sea.h
storage/innobase/include/btr0types.h
storage/innobase/include/buf0buf.h
storage/innobase/include/ha0ha.h
storage/innobase/include/ha0ha.ic
storage/innobase/include/row0upd.ic
storage/innobase/include/sync0sync.h
storage/innobase/page/page0page.c
storage/innobase/row/row0sel.c
storage/innobase/sync/sync0sync.c
=== modified file 'mysql-test/r/ctype_utf16.result'
--- a/mysql-test/r/ctype_utf16.result 2011-09-22 10:42:10 +0000
+++ b/mysql-test/r/ctype_utf16.result 2011-10-12 13:58:31 +0000
@@ -1133,6 +1133,20 @@ NULL
Warnings:
Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated
#
+# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+#
+SET NAMES utf8, @@character_set_connection=utf16;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+id l
+a 512
+Warnings:
+Warning 1260 Row 1 was cut by GROUP_CONCAT()
+#
# End of 5.5 tests
#
#
=== modified file 'mysql-test/r/ctype_utf32.result'
--- a/mysql-test/r/ctype_utf32.result 2011-03-01 12:20:38 +0000
+++ b/mysql-test/r/ctype_utf32.result 2011-10-12 13:58:31 +0000
@@ -1188,6 +1188,20 @@ CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END
b
DROP TABLE t1;
#
+# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+#
+SET NAMES utf8, @@character_set_connection=utf32;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+id l
+a 256
+Warnings:
+Warning 1260 Row 1 was cut by GROUP_CONCAT()
+#
# End of 5.5 tests
#
#
=== modified file 'mysql-test/r/ctype_utf8.result'
--- a/mysql-test/r/ctype_utf8.result 2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/ctype_utf8.result 2011-10-12 13:58:31 +0000
@@ -2879,7 +2879,7 @@ create table t1 as select group_concat(1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(342) CHARACTER SET utf8 DEFAULT NULL
+ `c1` text CHARACTER SET utf8
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select 1 as c1 union select 'a';
@@ -5124,6 +5124,20 @@ id select_type table type possible_keys
Warnings:
Note 1003 /* select#1 */ select 'abcdÁÂÃÄÅ' AS `abcdÁÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃÂÃÄÅ`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÁÂÃÄÅ`
#
+# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+#
+SET NAMES utf8;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+id l
+a 1024
+Warnings:
+Warning 1260 Row 2 was cut by GROUP_CONCAT()
+#
# End of 5.5 tests
#
#
=== modified file 'mysql-test/t/ctype_utf16.test'
--- a/mysql-test/t/ctype_utf16.test 2011-05-02 11:31:27 +0000
+++ b/mysql-test/t/ctype_utf16.test 2011-10-12 13:58:31 +0000
@@ -763,6 +763,20 @@ DROP TABLE t1;
SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second));
+
+--echo #
+--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+--echo #
+
+SET NAMES utf8, @@character_set_connection=utf16;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+
+
#
## TODO: add tests for all engines
#
=== modified file 'mysql-test/t/ctype_utf32.test'
--- a/mysql-test/t/ctype_utf32.test 2011-03-01 12:20:38 +0000
+++ b/mysql-test/t/ctype_utf32.test 2011-10-12 13:58:31 +0000
@@ -852,6 +852,19 @@ SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c
DROP TABLE t1;
--echo #
+--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+--echo #
+
+SET NAMES utf8, @@character_set_connection=utf32;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
=== modified file 'mysql-test/t/ctype_utf8.test'
--- a/mysql-test/t/ctype_utf8.test 2011-03-04 15:55:18 +0000
+++ b/mysql-test/t/ctype_utf8.test 2011-10-12 13:58:31 +0000
@@ -1582,6 +1582,18 @@ SET NAMES utf8;
EXPLAIN EXTENDED SELECT 'abcdÁÂ
--echo #
+--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+--echo #
+
+SET NAMES utf8;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+
+--echo #
--echo # End of 5.5 tests
--echo #
=== modified file 'sql/item.h'
--- a/sql/item.h 2011-09-07 12:41:53 +0000
+++ b/sql/item.h 2011-10-12 13:58:31 +0000
@@ -599,7 +599,7 @@ public:
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
virtual void cleanup();
virtual void make_field(Send_field *field);
- Field *make_string_field(TABLE *table);
+ virtual Field *make_string_field(TABLE *table);
virtual bool fix_fields(THD *, Item **);
/**
Fix after tables have been moved from one select_lex level to the parent
=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc 2011-07-29 09:29:11 +0000
+++ b/sql/item_sum.cc 2011-10-12 13:58:31 +0000
@@ -3129,6 +3129,31 @@ void Item_func_group_concat::cleanup()
}
+Field *Item_func_group_concat::make_string_field(TABLE *table)
+{
+ Field *field;
+ DBUG_ASSERT(collation.collation);
+ /*
+ max_characters is maximum number of characters
+ what can fit into max_length size. It's necessary
+ to use field size what allows to store group_concat
+ result without truncation. For this purpose we use
+ max_characters * CS->mbmaxlen.
+ */
+ const uint32 max_characters= max_length / collation.collation->mbminlen;
+ if (max_characters > CONVERT_IF_BIGGER_TO_BLOB)
+ field= new Field_blob(max_characters * collation.collation->mbmaxlen,
+ maybe_null, name, collation.collation, TRUE);
+ else
+ field= new Field_varstring(max_characters * collation.collation->mbmaxlen,
+ maybe_null, name, table->s, collation.collation);
+
+ if (field)
+ field->init(table);
+ return field;
+}
+
+
Item *Item_func_group_concat::copy_or_same(THD* thd)
{
return new (thd->mem_root) Item_func_group_concat(thd, this);
=== modified file 'sql/item_sum.h'
--- a/sql/item_sum.h 2011-06-30 15:50:45 +0000
+++ b/sql/item_sum.h 2011-10-12 13:58:31 +0000
@@ -1409,6 +1409,7 @@ public:
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
const char *func_name() const { return "group_concat"; }
virtual Item_result result_type () const { return STRING_RESULT; }
+ virtual Field *make_string_field(TABLE *table);
enum_field_types field_type() const
{
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk branch (sergey.glukhov:3487 to 3488) | Sergey Glukhov | 13 Oct |