} /* heap_update */
--- /dev/null
+++ b/mysql-test/r/percona_heap_blob.result
-@@ -0,0 +1,952 @@
+@@ -0,0 +1,956 @@
+SET @old_default_storage_engine=@@default_storage_engine;
+SET default_storage_engine=MEMORY;
+drop table if exists t1,t2,t3,t4,t5,t6,t7;
+a
+Where
+drop table t1;
-+create table t1 (t text,c char(10),b blob, d varbinary(10));
++create table t1 (t text,c char(10),b blob, d varbinary(10)) collate latin1_general_cs;
+insert into t1 values (NULL,NULL,NULL,NULL);
+insert into t1 values ("","","","");
+insert into t1 values ("hello","hello","hello","hello");
+lock tables t1 READ;
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
-+t text latin1_swedish_ci YES NULL #
-+c char(10) latin1_swedish_ci YES NULL #
++t text latin1_general_cs YES NULL #
++c char(10) latin1_general_cs YES NULL #
+b blob NULL YES NULL #
+d varbinary(10) NULL YES NULL #
+lock tables t1 WRITE;
+show full fields from t1;
+Field Type Collation Null Key Default Extra Privileges Comment
-+t text latin1_swedish_ci YES NULL #
-+c char(10) latin1_swedish_ci YES NULL #
++t text latin1_general_cs YES NULL #
++c char(10) latin1_general_cs YES NULL #
+b blob NULL YES NULL #
+d varbinary(10) NULL YES NULL #
+unlock tables;
+select t from t1 where t like "hello";
+t
+hello
-+HELLO
+select c from t1 where c like "hello";
+c
+hello
-+HELLO
+select b from t1 where b like "hello";
+b
+hello
+select c from t1 having c like "hello";
+c
+hello
-+HELLO
+select d from t1 having d like "hello";
+d
+hello
+select t from t1 where t like "%HELLO%";
+t
-+hello
+HELLO
+HELLO MY
+select c from t1 where c like "%HELLO%";
+c
-+hello
+HELLO
+HELLO MY
+select b from t1 where b like "%HELLO%";
+HELLO MY
+select c from t1 having c like "%HELLO%";
+c
-+hello
+HELLO
+HELLO MY
+select d from t1 having d like "%HELLO%";
+
+1
+a
-+hello
+HELLO
+HELLO MY
++hello
+select c from t1 order by c;
+c
+NULL
+
+
+a
-+hello
+HELLO
+HELLO MY
++hello
+select b from t1 order by b;
+b
+NULL
+NULL
+
+hello
++HELLO
+HELLO MY
+a
+1
+
+1
+a
-+hello
++HELLO
+HELLO MY
++hello
+select distinct b from t1 order by b;
+b
+NULL
+
+1
+a
-+hello
++HELLO
+HELLO MY
++hello
+select b from t1 group by b;
+b
+NULL
+NULL
+
+hello
++HELLO
+HELLO MY
+a
+1
+
+1
+a
-+hello
++HELLO
+HELLO MY
++hello
+select distinct b from t1 order by b;
+b
+NULL
+NULL
+
+hello
++HELLO
+HELLO MY
+a
+select distinct d from t1;
+NULL
+
+a
-+hello
++HELLO
+HELLO MY
++hello
+select distinct d from t1 order by d;
+d
+NULL
+NULL
+
+a
-+hello
++HELLO
+HELLO MY
++hello
+select d from t1 group by d;
+d
+NULL
+ 1
+1 1
+a 1
-+hello 2
++HELLO 1
+HELLO MY 1
++hello 1
+select b,count(*) from t1 group by b;
+b count(*)
+NULL 3
+NULL 2
+ 2
+a 1
-+hello 2
++HELLO 1
+HELLO MY 1
++hello 1
+select d,count(*) from t1 group by d;
+d count(*)
+NULL 2
+2
+DROP FUNCTION f1;
+DROP TABLE t1;
-+SET default_storage_engine=@old_default_storage_engine;
+SET @old_max_heap_table_size = @@global.max_heap_table_size;
+SET @old_max_allowed_packet = @@global.max_allowed_packet;
+SET GLOBAL max_heap_table_size = 18 * 1024 * 1024;
+SET GLOBAL max_allowed_packet = 24 * 1024 * 1024;
+drop table if exists t1;
-+CREATE TABLE t1 (data LONGBLOB) ENGINE=memory;
++CREATE TABLE t1 (data LONGBLOB);
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+select length(data) from t1;
+length(data)
+0
+drop table t1;
-+CREATE TABLE t1 (data BLOB) ENGINE=myisam;
++CREATE TABLE t1 (data BLOB);
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+Warnings:
+drop table t1;
+SET GLOBAL max_allowed_packet = @old_max_allowed_packet;
+SET GLOBAL max_heap_table_size = @old_max_heap_table_size;
++SET default_storage_engine=@old_default_storage_engine;
--- /dev/null
+++ b/mysql-test/r/percona_heap_bug783366.result
@@ -0,0 +1,14 @@
+#
+# test of blob, text, char and varbinary
+#
-+create table t1 (t text,c char(10),b blob, d varbinary(10));
++create table t1 (t text,c char(10),b blob, d varbinary(10)) collate latin1_general_cs;
+insert into t1 values (NULL,NULL,NULL,NULL);
+insert into t1 values ("","","","");
+insert into t1 values ("hello","hello","hello","hello");
+
+
+
-+SET default_storage_engine=@old_default_storage_engine;
+
+
+########################################################################
+
+# Bug #2159 (Problem with update of blob to > 16M)
+
-+CREATE TABLE t1 (data LONGBLOB) ENGINE=memory;
++CREATE TABLE t1 (data LONGBLOB);
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+select length(data) from t1;
+select length(data) from t1;
+drop table t1;
+
-+CREATE TABLE t1 (data BLOB) ENGINE=myisam;
++CREATE TABLE t1 (data BLOB);
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+select length(data) from t1;
+
+SET GLOBAL max_allowed_packet = @old_max_allowed_packet;
+SET GLOBAL max_heap_table_size = @old_max_heap_table_size;
++SET default_storage_engine=@old_default_storage_engine;
--- /dev/null
+++ b/mysql-test/t/percona_heap_bug783366.test
@@ -0,0 +1,19 @@