]> git.pld-linux.org Git - packages/mysql.git/blobdiff - memory_dynamic_rows.patch
- up to 5.5.28
[packages/mysql.git] / memory_dynamic_rows.patch
index 89bf6003aea8c68f7a399a17f1949bb9cea305e2..2b86c8476fbcefaf8a3f8ed2a215e71ad3df3f51 100644 (file)
@@ -19,7 +19,7 @@
  
  #define HP_MAX_LEVELS 4               /* 128^5 records is enough */
  #define HP_PTRS_IN_NOD        128
-@@ -130,22 +140,58 @@
+@@ -131,22 +141,58 @@
    uint (*get_key_length)(struct st_hp_keydef *keydef, const uchar *key);
  } HP_KEYDEF;
  
@@ -83,9 +83,9 @@
    uint open_count;
 -  uchar *del_link;                    /* Link to next block with del. rec */
    char * name;                        /* Name of "memory-file" */
+   time_t create_time;
    THR_LOCK lock;
-   mysql_mutex_t intern_lock;            /* Locking for use with _locking */
-@@ -154,6 +200,7 @@
+@@ -156,6 +202,7 @@
    uint auto_key;
    uint auto_key_type;                 /* real type of the auto key segment */
    ulonglong auto_increment;
@@ -93,7 +93,7 @@
  } HP_SHARE;
  
  struct st_hp_hash_info;
-@@ -163,7 +210,7 @@
+@@ -165,7 +212,7 @@
    HP_SHARE *s;
    uchar *current_ptr;
    struct st_hp_hash_info *current_hash_ptr;
    int lastinx,errkey;
    int  mode;                          /* Mode of file (READONLY..) */
    uint opt_flag,update;
-@@ -176,6 +223,9 @@
+@@ -178,6 +225,9 @@
    my_bool implicit_emptied;
    THR_LOCK_DATA lock;
    LIST open_list;
  } HP_INFO;
  
  
-@@ -197,6 +247,14 @@
+@@ -199,6 +249,14 @@
      open_count to 1. Is only looked at if not internal_table.
    */
    my_bool pin_share;
  } HP_CREATE_INFO;
  
        /* Prototypes for heap-functions */
-@@ -213,9 +271,8 @@
+@@ -215,9 +273,8 @@
  extern int heap_scan(register HP_INFO *info, uchar *record);
  extern int heap_delete(HP_INFO *info,const uchar *buff);
  extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag);
    }
  }
  
-@@ -428,6 +435,13 @@
+@@ -429,6 +436,13 @@
    return 0;
  }
  
  
  int ha_heap::extra(enum ha_extra_function operation)
  {
-@@ -645,23 +659,70 @@
+@@ -646,23 +660,70 @@
  heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
                              HP_CREATE_INFO *hp_create_info)
  {
    seg= reinterpret_cast<HA_KEYSEG*>(keydef + keys);
    for (key= 0; key < keys; key++)
    {
-@@ -677,11 +738,11 @@
+@@ -678,11 +739,11 @@
      case HA_KEY_ALG_UNDEF:
      case HA_KEY_ALG_HASH:
        keydef[key].algorithm= HA_KEY_ALG_HASH;
        break;
      default:
        DBUG_ASSERT(0); // cannot happen
-@@ -706,6 +767,16 @@
+@@ -707,6 +768,16 @@
        seg->length=  (uint) key_part->length;
        seg->flag=    key_part->key_part_flag;
  
        if (field->flags & (ENUM_FLAG | SET_FLAG))
          seg->charset= &my_charset_bin;
        else
-@@ -731,9 +802,75 @@
+@@ -732,9 +803,75 @@
          auto_key= key+ 1;
        auto_key_type= field->key_type();
        }
    if (table_arg->found_next_number_field)
    {
      keydef[share->next_number_index].flag|= HA_AUTO_KEY;
-@@ -744,16 +881,19 @@
+@@ -745,16 +882,19 @@
    hp_create_info->max_table_size=current_thd->variables.max_heap_table_size;
    hp_create_info->with_auto_increment= found_real_auto_increment;
    hp_create_info->internal_table= internal_table;
    return 0;
  }
  
-@@ -773,6 +913,7 @@
+@@ -774,6 +914,7 @@
                                  create_info->auto_increment_value - 1 : 0);
    error= heap_create(name, &hp_create_info, &internal_share, &created);
    my_free(hp_create_info.keydef);
    DBUG_ASSERT(file == 0);
    return (error);
  }
-@@ -783,6 +924,13 @@
+@@ -784,6 +925,13 @@
    table->file->info(HA_STATUS_AUTO);
    if (!(create_info->used_fields & HA_CREATE_USED_AUTO))
      create_info->auto_increment_value= stats.auto_increment_value;
        /* Fix keys */
      memcpy(share->keydef, keydef, (size_t) (sizeof(keydef[0]) * keys));
      for (i= 0, keyinfo= share->keydef; i < keys; i++, keyinfo++)
-@@ -177,15 +310,35 @@
+@@ -177,16 +310,36 @@
      share->min_records= min_records;
      share->max_records= max_records;
      share->max_table_size= create_info->max_table_size;
      share->auto_key= create_info->auto_key;
      share->auto_key_type= create_info->auto_key_type;
      share->auto_increment= create_info->auto_increment;
+     share->create_time= (long) time((time_t*) 0);
 +
 +    share->fixed_data_length= fixed_data_length;
 +    share->fixed_column_count= fixed_column_count;
      /* Must be allocated separately for rename to work */
      if (!(share->name= my_strdup(name,MYF(0))))
      {
-@@ -227,7 +380,7 @@
+@@ -228,7 +381,7 @@
                    param->search_flag, not_used);
  }
  
                       ulong max_records)
  {
    uint i,recbuffer,records_in_block;
-@@ -235,7 +388,12 @@
+@@ -236,7 +389,12 @@
    max_records= max(min_records,max_records);
    if (!max_records)
      max_records= 1000;                        /* As good as quess as anything */
      records_in_block= 10;
 --- a/storage/heap/hp_delete.c
 +++ b/storage/heap/hp_delete.c
-@@ -22,6 +22,8 @@
+@@ -22,6 +22,7 @@
    uchar *pos;
    HP_SHARE *share=info->s;
    HP_KEYDEF *keydef, *end, *p_lastinx;
-+  uint rec_length, chunk_count;
 +
    DBUG_ENTER("heap_delete");
    DBUG_PRINT("enter",("info: 0x%lx  record: 0x%lx", (long) info, (long) record));
  
-@@ -31,6 +33,8 @@
-     DBUG_RETURN(my_errno);                    /* Record changed */
-   share->changed=1;
-+  rec_length = hp_get_encoded_data_length(share, record, &chunk_count);
-+
-   if ( --(share->records) < share->blength >> 1) share->blength>>=1;
-   pos=info->current_ptr;
-@@ -43,10 +47,7 @@
+@@ -43,10 +44,7 @@
    }
  
    info->update=HA_STATE_DELETED;
    info->current_hash_ptr=0;
  #if !defined(DBUG_OFF) && defined(EXTRA_HEAP_DEBUG)
    DBUG_EXECUTE("check_heap",heap_check_heap(info, 0););
-@@ -75,7 +76,8 @@
+@@ -75,7 +73,8 @@
      info->last_pos= NULL; /* For heap_rnext/heap_rprev */
  
    custom_arg.keyseg= keyinfo->seg;
    custom_arg.search_flag= SEARCH_SAME;
    old_allocated= keyinfo->rb_tree.allocated;
    res= tree_delete(&keyinfo->rb_tree, info->recbuf, custom_arg.key_length,
-@@ -112,6 +114,7 @@
+@@ -112,6 +111,7 @@
    blength=share->blength;
    if (share->records+1 == blength)
      blength+= blength;
  
  #define MAX_RECORDS 100000
  #define MAX_KEYS 4
-@@ -44,6 +45,7 @@
-   register uint i,j;
-   uint ant,n1,n2,n3;
-   uint write_count,update,opt_delete,check2,dupp_keys,found_key;
-+  uint mem_per_keys;
-   int error;
-   ulong pos;
-   unsigned long key_check;
-@@ -53,6 +55,7 @@
+@@ -53,6 +54,7 @@
    HP_SHARE *tmp_share;
    HP_KEYDEF keyinfo[MAX_KEYS];
    HA_KEYSEG keyseg[MAX_KEYS*5];
    HEAP_PTR UNINIT_VAR(position);
    HP_CREATE_INFO hp_create_info;
    CHARSET_INFO *cs= &my_charset_latin1;
-@@ -65,12 +68,16 @@
+@@ -65,12 +67,16 @@
    get_options(argc,argv);
  
    bzero(&hp_create_info, sizeof(hp_create_info));
  
    write_count=update=opt_delete=0;
    key_check=0;
-@@ -118,11 +125,30 @@
+@@ -118,11 +124,28 @@
    keyinfo[3].seg[0].null_pos=38;
    keyinfo[3].seg[0].charset=cs;
  
 +  columndef[3].length= 1;
 +  columndef[3].null_bit= 1;
 +  columndef[3].null_pos= 38;
-+
-+  mem_per_keys= (sizeof(char*) * 2) * 4;
 +
    bzero((char*) key1,sizeof(key1));
    bzero((char*) key3,sizeof(key3));
    HP_KEYDEF *keydef, *end;
    uchar *pos;
    HP_SHARE *share=info->s;
-+  uint rec_length, chunk_count;
++  uint chunk_count;
 +
    DBUG_ENTER("heap_write");
  #ifndef DBUG_OFF
 +    DBUG_RETURN(my_errno);
 +  }
 +
-+  rec_length= hp_get_encoded_data_length(share, record, &chunk_count);
++  hp_get_encoded_data_length(share, record, &chunk_count);
 +
 +  if (!(pos= hp_allocate_chunkset(&share->recordspace, chunk_count)))
      DBUG_RETURN(my_errno);
    Write a hash-key to the hash-index
 --- a/storage/heap/hp_update.c
 +++ b/storage/heap/hp_update.c
-@@ -17,43 +17,66 @@
+@@ -17,43 +17,65 @@
  
  #include "heapdef.h"
  
    uchar *pos;
    my_bool auto_key_changed= 0;
    HP_SHARE *share= info->s;
-+  uint old_length, new_length;
 +  uint old_chunk_count, new_chunk_count;
 +
    DBUG_ENTER("heap_update");
 +  if (info->opt_flag & READ_CHECK_USED && hp_rectest(info, old_record))
      DBUG_RETURN(my_errno);                            /* Record changed */
 +
-+  old_length = hp_get_encoded_data_length(share, old_record, &old_chunk_count);
-+  new_length = hp_get_encoded_data_length(share, new_record, &new_chunk_count);
++  hp_get_encoded_data_length(share, old_record, &old_chunk_count);
++  hp_get_encoded_data_length(share, new_record, &new_chunk_count);
 +
 +  if (new_chunk_count > old_chunk_count)
 +  {
    DBUG_RETURN(0);
  
   err:
-@@ -63,7 +86,7 @@
+@@ -63,7 +85,7 @@
      if (keydef->algorithm == HA_KEY_ALG_BTREE)
      {
        /* we don't need to delete non-inserted key from rb-tree */
        {
          if (++(share->records) == share->blength)
          share->blength+= share->blength;
-@@ -73,10 +96,10 @@
+@@ -73,10 +95,10 @@
      }
      while (keydef >= share->keydef)
      {
          break;
        }
        keydef--;
-@@ -84,5 +107,12 @@
+@@ -84,5 +106,12 @@
    }
    if (++(share->records) == share->blength)
      share->blength+= share->blength;
 +
    DBUG_RETURN(my_errno);
  } /* heap_update */
+--- /dev/null
++++ b/mysql-test/r/percona_heap_blob.result
+@@ -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;
++CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
++show columns from t1;
++Field Type    Null    Key     Default Extra
++a     blob    YES             NULL    
++b     text    YES             NULL    
++c     tinyblob        YES             NULL    
++d     mediumtext      YES             NULL    
++e     longtext        YES             NULL    
++CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000));
++Warnings:
++Note  1246    Converting column 'b' from VARBINARY to BLOB
++Note  1246    Converting column 'c' from VARCHAR to TEXT
++CREATE TABLE t4 (c varchar(65530) character set utf8 not null);
++Warnings:
++Note  1246    Converting column 'c' from VARCHAR to TEXT
++show columns from t2;
++Field Type    Null    Key     Default Extra
++a     char(255)       YES             NULL    
++b     mediumblob      YES             NULL    
++c     longtext        YES             NULL    
++create table t3 (a long, b long byte);
++show create TABLE t3;
++Table Create Table
++t3    CREATE TABLE `t3` (
++  `a` mediumtext,
++  `b` mediumblob
++) ENGINE=MEMORY DEFAULT CHARSET=latin1
++show create TABLE t4;
++Table Create Table
++t4    CREATE TABLE `t4` (
++  `c` mediumtext CHARACTER SET utf8 NOT NULL
++) ENGINE=MEMORY DEFAULT CHARSET=latin1
++drop table t1,t2,t3,t4;
++CREATE TABLE t1 (a char(257) default "hello");
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE t2 (a char(256));
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE t1 (a varchar(70000) default "hello");
++ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
++CREATE TABLE t2 (a blob default "hello");
++ERROR 42000: BLOB/TEXT column 'a' can't have a default value
++drop table if exists t1,t2;
++create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
++insert into t1 values (null,"a","A");
++insert into t1 values (null,"bbb","BBB");
++insert into t1 values (null,"ccc","CCC");
++select last_insert_id();
++last_insert_id()
++3
++select * from t1,t1 as t2;
++nr    b       str     nr      b       str
++1     a       A       1       a       A
++2     bbb     BBB     1       a       A
++3     ccc     CCC     1       a       A
++1     a       A       2       bbb     BBB
++2     bbb     BBB     2       bbb     BBB
++3     ccc     CCC     2       bbb     BBB
++1     a       A       3       ccc     CCC
++2     bbb     BBB     3       ccc     CCC
++3     ccc     CCC     3       ccc     CCC
++drop table t1;
++create table t1 (a text);
++insert into t1 values ('where');
++update t1 set a='Where';
++select * from t1;
++a
++Where
++drop table t1;
++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");
++insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
++insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
++insert into t1 values ("a","a","a","a");
++insert into t1 values (1,1,1,1);
++insert into t1 values (NULL,NULL,NULL,NULL);
++update t1 set c="",b=null where c="1";
++lock tables t1 READ;
++show full fields from t1;
++Field Type    Collation       Null    Key     Default Extra   Privileges      Comment
++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_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
++select c from t1 where c like "hello";
++c
++hello
++select b from t1 where b like "hello";
++b
++hello
++select d from t1 where d like "hello";
++d
++hello
++select c from t1 having c like "hello";
++c
++hello
++select d from t1 having d like "hello";
++d
++hello
++select t from t1 where t like "%HELLO%";
++t
++HELLO
++HELLO MY
++select c from t1 where c like "%HELLO%";
++c
++HELLO
++HELLO MY
++select b from t1 where b like "%HELLO%";
++b
++HELLO
++HELLO MY
++select d from t1 where d like "%HELLO%";
++d
++HELLO
++HELLO MY
++select c from t1 having c like "%HELLO%";
++c
++HELLO
++HELLO MY
++select d from t1 having d like "%HELLO%";
++d
++HELLO
++HELLO MY
++select d from t1 having d like "%HE%LLO%";
++d
++HELLO
++HELLO MY
++select t from t1 order by t;
++t
++NULL
++NULL
++
++1
++a
++HELLO
++HELLO MY
++hello
++select c from t1 order by c;
++c
++NULL
++NULL
++
++
++a
++HELLO
++HELLO MY
++hello
++select b from t1 order by b;
++b
++NULL
++NULL
++NULL
++
++HELLO
++HELLO MY
++a
++hello
++select d from t1 order by d;
++d
++NULL
++NULL
++
++1
++HELLO
++HELLO MY
++a
++hello
++select distinct t from t1;
++t
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++1
++select distinct b from t1;
++b
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++select distinct t from t1 order by t;
++t
++NULL
++
++1
++a
++HELLO
++HELLO MY
++hello
++select distinct b from t1 order by b;
++b
++NULL
++
++HELLO
++HELLO MY
++a
++hello
++select t from t1 group by t;
++t
++NULL
++
++1
++a
++HELLO
++HELLO MY
++hello
++select b from t1 group by b;
++b
++NULL
++
++HELLO
++HELLO MY
++a
++hello
++set option sql_big_tables=1;
++select distinct t from t1;
++t
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++1
++select distinct b from t1;
++b
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++select distinct t from t1 order by t;
++t
++NULL
++
++1
++a
++HELLO
++HELLO MY
++hello
++select distinct b from t1 order by b;
++b
++NULL
++
++HELLO
++HELLO MY
++a
++hello
++select distinct c from t1;
++c
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++select distinct d from t1;
++d
++NULL
++
++hello
++HELLO
++HELLO MY
++a
++1
++select distinct c from t1 order by c;
++c
++NULL
++
++a
++HELLO
++HELLO MY
++hello
++select distinct d from t1 order by d;
++d
++NULL
++
++1
++HELLO
++HELLO MY
++a
++hello
++select c from t1 group by c;
++c
++NULL
++
++a
++HELLO
++HELLO MY
++hello
++select d from t1 group by d;
++d
++NULL
++
++1
++HELLO
++HELLO MY
++a
++hello
++set option sql_big_tables=0;
++select distinct * from t1;
++t     c       b       d
++NULL  NULL    NULL    NULL
++                      
++hello hello   hello   hello
++HELLO HELLO   HELLO   HELLO
++HELLO MY      HELLO MY        HELLO MY        HELLO MY
++a     a       a       a
++1             NULL    1
++select t,count(*) from t1 group by t;
++t     count(*)
++NULL  2
++      1
++1     1
++a     1
++HELLO 1
++HELLO MY      1
++hello 1
++select b,count(*) from t1 group by b;
++b     count(*)
++NULL  3
++      1
++HELLO 1
++HELLO MY      1
++a     1
++hello 1
++select c,count(*) from t1 group by c;
++c     count(*)
++NULL  2
++      2
++a     1
++HELLO 1
++HELLO MY      1
++hello 1
++select d,count(*) from t1 group by d;
++d     count(*)
++NULL  2
++      1
++1     1
++HELLO 1
++HELLO MY      1
++a     1
++hello 1
++drop table t1;
++CREATE TABLE t1 (
++t1_id bigint(21) NOT NULL auto_increment,
++_field_72 varchar(128) DEFAULT '' NOT NULL,
++_field_95 varchar(32),
++_field_115 tinyint(4) DEFAULT '0' NOT NULL,
++_field_122 tinyint(4) DEFAULT '0' NOT NULL,
++_field_126 tinyint(4),
++_field_134 tinyint(4),
++PRIMARY KEY (t1_id),
++UNIQUE _field_72 (_field_72),
++KEY _field_115 (_field_115),
++KEY _field_122 (_field_122)
++);
++INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
++INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
++INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
++CREATE TABLE t2 (
++seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++PRIMARY KEY (seq_0_id,seq_1_id)
++);
++INSERT INTO t2 VALUES (1,1);
++INSERT INTO t2 VALUES (2,1);
++INSERT INTO t2 VALUES (2,2);
++CREATE TABLE t3 (
++t3_id bigint(21) NOT NULL auto_increment,
++_field_131 varchar(128),
++_field_133 tinyint(4) DEFAULT '0' NOT NULL,
++_field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
++_field_137 tinyint(4),
++_field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
++_field_140 blob,
++_field_142 tinyint(4) DEFAULT '0' NOT NULL,
++_field_145 tinyint(4) DEFAULT '0' NOT NULL,
++_field_148 tinyint(4) DEFAULT '0' NOT NULL,
++PRIMARY KEY (t3_id),
++KEY _field_133 (_field_133),
++KEY _field_135 (_field_135),
++KEY _field_139 (_field_139),
++KEY _field_142 (_field_142),
++KEY _field_145 (_field_145),
++KEY _field_148 (_field_148)
++);
++INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
++INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
++CREATE TABLE t4 (
++seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++PRIMARY KEY (seq_0_id,seq_1_id)
++);
++INSERT INTO t4 VALUES (1,1);
++INSERT INTO t4 VALUES (2,1);
++CREATE TABLE t5 (
++t5_id bigint(21) NOT NULL auto_increment,
++_field_149 tinyint(4),
++_field_156 varchar(128) DEFAULT '' NOT NULL,
++_field_157 varchar(128) DEFAULT '' NOT NULL,
++_field_158 varchar(128) DEFAULT '' NOT NULL,
++_field_159 varchar(128) DEFAULT '' NOT NULL,
++_field_160 varchar(128) DEFAULT '' NOT NULL,
++_field_161 varchar(128) DEFAULT '' NOT NULL,
++PRIMARY KEY (t5_id),
++KEY _field_156 (_field_156),
++KEY _field_157 (_field_157),
++KEY _field_158 (_field_158),
++KEY _field_159 (_field_159),
++KEY _field_160 (_field_160),
++KEY _field_161 (_field_161)
++);
++INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
++INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
++CREATE TABLE t6 (
++seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++PRIMARY KEY (seq_0_id,seq_1_id)
++);
++INSERT INTO t6 VALUES (1,1);
++INSERT INTO t6 VALUES (1,2);
++INSERT INTO t6 VALUES (2,2);
++CREATE TABLE t7 (
++t7_id bigint(21) NOT NULL auto_increment,
++_field_143 tinyint(4),
++_field_165 varchar(32),
++_field_166 smallint(6) DEFAULT '0' NOT NULL,
++PRIMARY KEY (t7_id),
++KEY _field_166 (_field_166)
++);
++INSERT INTO t7 VALUES (1,0,'High',1);
++INSERT INTO t7 VALUES (2,0,'Medium',2);
++INSERT INTO t7 VALUES (3,0,'Low',3);
++select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
++replace(t3._field_140, "\r","^M")     t3_id   min(t3._field_131)      min(t3._field_135)      min(t3._field_139)      min(t3._field_137)      min(link_alias_142._field_165)  min(link_alias_133._field_72)   min(t3._field_145)      min(link_alias_148._field_156)  replace(min(t3._field_140), "\r","^M")  t3_id
++test^M
++job^M
++1     1       test job 1      0000-00-00 00:00:00     1999-02-25 22:43:32     0       High    admin   0       tomato  test^M
++job^M
++1     1
++drop table t1,t2,t3,t4,t5,t6,t7;
++create table t1 (a blob);
++insert into t1 values ("empty"),("");
++select a,reverse(a) from t1;
++a     reverse(a)
++empty ytpme
++      
++drop table t1;
++create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
++Warnings:
++Warning       1101    BLOB/TEXT column 'imagem' can't have a default value
++insert into t1 (id) values (1);
++select
++charset(load_file('../../std_data/words.dat')),
++collation(load_file('../../std_data/words.dat')),
++coercibility(load_file('../../std_data/words.dat'));
++charset(load_file('../../std_data/words.dat'))        collation(load_file('../../std_data/words.dat'))        coercibility(load_file('../../std_data/words.dat'))
++binary        binary  4
++explain extended select
++charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')),
++collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')),
++coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'));
++id    select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
++1     SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
++Warnings:
++Note  1003    select charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`
++update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data/words.dat') where id=1;
++select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
++if(imagem is null, "ERROR", "OK")     length(imagem)
++OK    581
++drop table t1;
++create table t1 select load_file('MYSQLTEST_VARDIR/std_data/words.dat') l;
++show full fields from t1;
++Field Type    Collation       Null    Key     Default Extra   Privileges      Comment
++l     longblob        NULL    YES             NULL            #       
++drop table t1;
++create table t1 (id integer primary key auto_increment, txt text not null);
++insert into t1 (txt) values ('Chevy ');
++select * from t1 where txt='Chevy';
++id    txt
++1     Chevy 
++select * from t1 where txt='Chevy ';
++id    txt
++1     Chevy 
++select * from t1 where txt='Chevy ' or txt='Chevy';
++id    txt
++1     Chevy 
++select * from t1 where txt='Chevy' or txt='Chevy ';
++id    txt
++1     Chevy 
++select * from t1 where id='1' or id='2';
++id    txt
++1     Chevy 
++insert into t1 (txt) values('Ford');
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
++id    txt
++1     Chevy 
++2     Ford
++select * from t1 where txt='Chevy' or txt='Chevy ';
++id    txt
++1     Chevy 
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
++id    txt
++1     Chevy 
++select * from t1 where txt in ('Chevy ','Chevy');
++id    txt
++1     Chevy 
++select * from t1 where txt in ('Chevy');
++id    txt
++1     Chevy 
++select * from t1 where txt between 'Chevy' and 'Chevy';
++id    txt
++1     Chevy 
++select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
++id    txt
++1     Chevy 
++select * from t1 where txt between 'Chevy' and 'Chevy ';
++id    txt
++1     Chevy 
++select * from t1 where txt < 'Chevy ';
++id    txt
++select * from t1 where txt <= 'Chevy';
++id    txt
++1     Chevy 
++select * from t1 where txt > 'Chevy';
++id    txt
++2     Ford
++select * from t1 where txt >= 'Chevy';
++id    txt
++1     Chevy 
++2     Ford
++drop table t1;
++create table t1 (id integer primary key auto_increment, txt text);
++insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
++select * from t1 where txt='Chevy' or txt is NULL;
++id    txt
++1     Chevy
++2     Chevy 
++3     NULL
++explain select * from t1 where txt='Chevy' or txt is NULL;
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    3       Using where
++select * from t1 where txt='Chevy ';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt='Chevy ' or txt='Chevy';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt='Chevy' or txt='Chevy ';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where id='1' or id='2';
++id    txt
++1     Chevy
++2     Chevy 
++insert into t1 (txt) values('Ford');
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
++id    txt
++1     Chevy
++2     Chevy 
++4     Ford
++select * from t1 where txt='Chevy' or txt='Chevy ';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt in ('Chevy ','Chevy');
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt in ('Chevy');
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt between 'Chevy' and 'Chevy';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt between 'Chevy' and 'Chevy ';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt < 'Chevy ';
++id    txt
++select * from t1 where txt < 'Chevy ' or txt is NULL;
++id    txt
++3     NULL
++select * from t1 where txt <= 'Chevy';
++id    txt
++1     Chevy
++2     Chevy 
++select * from t1 where txt > 'Chevy';
++id    txt
++4     Ford
++select * from t1 where txt >= 'Chevy';
++id    txt
++1     Chevy
++2     Chevy 
++4     Ford
++alter table t1 modify column txt blob;
++explain select * from t1 where txt='Chevy' or txt is NULL;
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    4       Using where
++select * from t1 where txt='Chevy' or txt is NULL;
++id    txt
++1     Chevy
++3     NULL
++explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    4       Using where; Using filesort
++select * from t1 where txt='Chevy' or txt is NULL order by txt;
++id    txt
++3     NULL
++1     Chevy
++drop table t1;
++CREATE TABLE t1 ( i int(11) NOT NULL default '0',    c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY  (i));
++INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
++select max(i) from t1 where c = '';
++max(i)
++4
++drop table t1;
++CREATE table t1 (a blob);
++insert into t1 values ('b'),('a\0'),('a'),('a '),('aa'),(NULL);
++select hex(a) from t1 order by a;
++hex(a)
++NULL
++61
++6100
++6120
++6161
++62
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++b
++NULL
++6100
++610000
++612000
++616100
++6200
++alter table t1 modify a varbinary(5);
++select hex(a) from t1 order by a;
++hex(a)
++NULL
++61
++6100
++6120
++6161
++62
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++b
++NULL
++6100
++610000
++612000
++616100
++6200
++alter table t1 modify a char(5);
++select hex(a) from t1 order by a;
++hex(a)
++NULL
++6100
++61
++61
++6161
++62
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++b
++NULL
++610000
++6100
++6100
++616100
++6200
++alter table t1 modify a binary(5);
++select hex(a) from t1 order by a;
++hex(a)
++NULL
++6100000000
++6100000000
++6100000000
++6161000000
++6200000000
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++b
++NULL
++610000000000
++610000000000
++610000000000
++616100000000
++620000000000
++drop table t1;
++create table t1 (a text default '');
++Warnings:
++Warning       1101    BLOB/TEXT column 'a' can't have a default value
++show create table t1;
++Table Create Table
++t1    CREATE TABLE `t1` (
++  `a` text
++) ENGINE=MEMORY DEFAULT CHARSET=latin1
++insert into t1 values (default);
++select * from t1;
++a
++NULL
++drop table t1;
++set @@sql_mode='TRADITIONAL';
++create table t1 (a text default '');
++ERROR 42000: BLOB/TEXT column 'a' can't have a default value
++set @@sql_mode='';
++CREATE TABLE t (c TEXT CHARSET ASCII);
++INSERT INTO t (c) VALUES (REPEAT('1',65537));
++Warnings:
++Warning       1265    Data truncated for column 'c' at row 1
++INSERT INTO t (c) VALUES (REPEAT('2',65536));
++Warnings:
++Warning       1265    Data truncated for column 'c' at row 1
++INSERT INTO t (c) VALUES (REPEAT('3',65535));
++SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
++LENGTH(c)     CHAR_LENGTH(c)
++65535 65535
++65535 65535
++65535 65535
++DROP TABLE t;
++drop table if exists b15776;
++create table b15776 (data blob(2147483647));
++drop table b15776;
++create table b15776 (data blob(-1));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
++create table b15776 (data blob(2147483648));
++drop table b15776;
++create table b15776 (data blob(4294967294));
++drop table b15776;
++create table b15776 (data blob(4294967295));
++drop table b15776;
++create table b15776 (data blob(4294967296));
++ERROR 42000: Display width out of range for column 'data' (max = 4294967295)
++CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) );
++show columns from b15776;
++Field Type    Null    Key     Default Extra
++a     longblob        YES             NULL    
++b     longblob        YES             NULL    
++c     longblob        YES             NULL    
++a1    longtext        YES             NULL    
++b1    longtext        YES             NULL    
++c1    longtext        YES             NULL    
++drop table b15776;
++CREATE TABLE b15776 (a blob(4294967296));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a text(4294967296));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a int(0));
++INSERT INTO b15776 values (NULL), (1), (42), (654);
++SELECT * from b15776 ORDER BY a;
++a
++NULL
++1
++42
++654
++DROP TABLE b15776;
++CREATE TABLE b15776 (a int(-1));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
++CREATE TABLE b15776 (a int(255));
++DROP TABLE b15776;
++CREATE TABLE b15776 (a int(256));
++ERROR 42000: Display width out of range for column 'a' (max = 255)
++CREATE TABLE b15776 (data blob(-1));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
++CREATE TABLE b15776 (a char(2147483647));
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE b15776 (a char(2147483648));
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE b15776 (a char(4294967295));
++ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
++CREATE TABLE b15776 (a char(4294967296));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a year(4294967295));
++INSERT INTO b15776 VALUES (42);
++SELECT * FROM b15776;
++a
++2042
++DROP TABLE b15776;
++CREATE TABLE b15776 (a year(4294967296));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a year(0));
++DROP TABLE b15776;
++CREATE TABLE b15776 (a year(-2));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1
++CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
++CREATE TABLE b15776 select cast(null as char(4294967295));
++show columns from b15776;
++Field Type    Null    Key     Default Extra
++cast(null as char(4294967295))        char(0) YES             NULL    
++drop table b15776;
++CREATE TABLE b15776 select cast(null as nchar(4294967295));
++show columns from b15776;
++Field Type    Null    Key     Default Extra
++cast(null as nchar(4294967295))       char(0) YES             NULL    
++drop table b15776;
++CREATE TABLE b15776 select cast(null as binary(4294967295));
++show columns from b15776;
++Field Type    Null    Key     Default Extra
++cast(null as binary(4294967295))      binary(0)       YES             NULL    
++drop table b15776;
++explain select cast(1 as char(4294967295));
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
++explain select cast(1 as nchar(4294967295));
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
++explain select cast(1 as binary(4294967295));
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
++explain select cast(1 as char(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select cast(1 as nchar(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select cast(1 as binary(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select cast(1 as decimal(-1));
++ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
++explain select cast(1 as decimal(64, 30));
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
++explain select cast(1 as decimal(64, 999999999999999999999999999999));
++Got one of the listed errors
++explain select cast(1 as decimal(4294967296));
++Got one of the listed errors
++explain select cast(1 as decimal(999999999999999999999999999999999999));
++Got one of the listed errors
++explain select convert(1, char(4294967295));
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
++explain select convert(1, char(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, nchar(4294967295));
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
++explain select convert(1, nchar(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, binary(4294967295));
++id    select_type     table   type    possible_keys   key     key_len ref     rows    Extra
++1     SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
++explain select convert(1, binary(4294967296));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
++End of 5.0 tests
++CREATE TABLE t1(id INT NOT NULL);
++CREATE TABLE t2(id INT NOT NULL, c TEXT NOT NULL);
++INSERT INTO t1 VALUES (1);
++INSERT INTO t2 VALUES (1, '');
++UPDATE t2 SET c = REPEAT('1', 70000);
++Warnings:
++Warning       1265    Data truncated for column 'c' at row 1
++SELECT LENGTH(c) FROM t2;
++LENGTH(c)
++65535
++UPDATE t1 LEFT JOIN t2 USING(id) SET t2.c = REPEAT('1', 70000) WHERE t1.id = 1;
++Warnings:
++Warning       1265    Data truncated for column 'c' at row 1
++SELECT LENGTH(c) FROM t2;
++LENGTH(c)
++65535
++DROP TABLE t1, t2;
++# Bug #52160: crash and inconsistent results when grouping
++#             by a function and column
++CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
++CREATE TABLE t1(a CHAR(1));
++INSERT INTO t1 VALUES ('0'), ('0');
++SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
++COUNT(*)
++2
++DROP FUNCTION f1;
++DROP TABLE t1;
++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);
++INSERT INTO t1 (data) VALUES (NULL);
++UPDATE t1 set data=repeat('a',18*1024*1024);
++select length(data) from t1;
++length(data)
++18874368
++delete from t1 where left(data,1)='a';
++truncate table t1;
++INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
++INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
++delete from t1 where left(data,1)='b';
++UPDATE t1 set data=repeat('c',17*1024*1024);
++delete from t1 where left(data,1)='c';
++INSERT INTO t1 set data=repeat('a',18*1024*1024);
++select length(data) from t1;
++length(data)
++18874368
++alter table t1 modify data blob;
++select length(data) from t1;
++length(data)
++0
++drop table t1;
++CREATE TABLE t1 (data BLOB);
++INSERT INTO t1 (data) VALUES (NULL);
++UPDATE t1 set data=repeat('a',18*1024*1024);
++Warnings:
++Warning       1265    Data truncated for column 'data' at row 1
++select length(data) from t1;
++length(data)
++65535
++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 @@
++drop table if exists t1;
++CREATE TABLE t1 (
++f1 VARCHAR ( 128 ) ,
++f2 VARCHAR ( 32 ),
++PRIMARY KEY ( f2 ( 2 ) , f1 )
++)
++ENGINE=HEAP KEY_BLOCK_SIZE = 512;
++INSERT IGNORE INTO t1 VALUES ( 'te' , 'm') , ( NULL , 'think' );
++Warnings:
++Warning       1048    Column 'f1' cannot be null
++INSERT IGNORE INTO t1 VALUES ( 'te' , 'm') , ( NULL , 'think' );
++Warnings:
++Warning       1048    Column 'f1' cannot be null
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug783451.result
+@@ -0,0 +1,132 @@
++DROP TABLE IF EXISTS local_1_1;
++CREATE  TABLE IF NOT EXISTS local_1_1 ( f1 VARCHAR ( 32 ) NOT NULL  , f2 VARCHAR ( 128 ) NOT NULL DEFAULT 'cboepfaobilcchabvglgjdbynog' , f3 VARCHAR ( 32 ) NOT NULL  , f4 VARBINARY ( 32 ) NOT NULL  , f5 VARBINARY ( 1024 )  DEFAULT 'ycboepfao' , KEY ( f1 /* ( 2 ) */ , f2 /* ( 2 ) */ ) ) ENGINE=HEAP KEY_BLOCK_SIZE = 512;
++INSERT IGNORE INTO local_1_1 VALUES ( REPEAT( 'ervydbimvmbqmsowdbsa' , 1 ) , 'v' , NULL , NULL , REPEAT( 'mervydbimvmbqms' , 5 ) ) , ( 'p' , 6 , 'n' , REPEAT( 'imervydbimvmbqmsowdbs' , 4 ) , 'do' ) , ( NULL , NULL , REPEAT( 'himervydbimvmbqmsowdbsaybudvwaamvhempuublmia' , 6 ) , REPEAT('X', POW(2, 20) * 2) , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT('X', POW(2, 20) * 2) , REPEAT( 'Y' , 763 ) , NULL , REPEAT('X', POW(2, 20) * 2) , NULL ) , ( REPEAT('X', POW(2, 20) * 2) , 'time' , 'how' , 2 , REPEAT( 'Y' , 107 ) ) , ( REPEAT( 'hyshimervydbimvmbqmsowdbsaybud' , 5 ) , 2 , 8 , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( 'come' , NULL , 'i' , NULL , REPEAT('X', POW(2, 20) * 2) );
++Warnings:
++Warning       1048    Column 'f3' cannot be null
++Warning       1048    Column 'f4' cannot be null
++Warning       1265    Data truncated for column 'f4' at row 2
++Warning       1048    Column 'f1' cannot be null
++Warning       1048    Column 'f2' cannot be null
++Warning       1265    Data truncated for column 'f3' at row 3
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f4' cannot be null
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f1' cannot be null
++Warning       1265    Data truncated for column 'f2' at row 4
++Warning       1048    Column 'f3' cannot be null
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f4' cannot be null
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f1' cannot be null
++Warning       1265    Data truncated for column 'f1' at row 6
++Warning       1048    Column 'f4' cannot be null
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f2' cannot be null
++Warning       1048    Column 'f4' cannot be null
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++INSERT IGNORE INTO local_1_1 VALUES ( 'ok' , NULL , REPEAT( 'Y' , 651 ) , 2 , 5 ) , ( REPEAT( 'zylcdzkfrqpihyshimervydbimvmbqmsowdbsaybu' , 3 ) , REPEAT( 'Y' , 282 ) , REPEAT( 'X' , 0 ) , REPEAT( 'Y' , 369 ) , 'g' ) , ( 'think' , REPEAT('X', POW(2, 20) * 2), NULL , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT( 'Y' , 468 ) , REPEAT( 'dfvbrzylcd' , 6 ) , REPEAT( 'Y' , 264 ) , NULL , 'c' ) , ( NULL , NULL , REPEAT( 'srdfvbrzylcdzkfrqpihyshimervydbimvmbqms' , 0 ) , REPEAT( 'Y' , 244 ) , 7 ) , ( REPEAT( 'Y' , 0 ) , 'how' , 'going' , 'q' , NULL );
++Warnings:
++Warning       1048    Column 'f2' cannot be null
++Warning       1265    Data truncated for column 'f3' at row 1
++Warning       1265    Data truncated for column 'f1' at row 2
++Warning       1265    Data truncated for column 'f2' at row 2
++Warning       1265    Data truncated for column 'f4' at row 2
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f2' cannot be null
++Warning       1048    Column 'f3' cannot be null
++Warning       1048    Column 'f4' cannot be null
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1265    Data truncated for column 'f1' at row 4
++Warning       1265    Data truncated for column 'f3' at row 4
++Warning       1048    Column 'f4' cannot be null
++Warning       1048    Column 'f1' cannot be null
++Warning       1048    Column 'f2' cannot be null
++Warning       1265    Data truncated for column 'f4' at row 5
++INSERT IGNORE INTO local_1_1 VALUES ( REPEAT('X', POW(2, 20) * 2) , NULL , NULL , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT('X', POW(2, 20) * 2) , NULL , REPEAT('X', POW(2, 20) * 2) , 'this' , 'e' ) , ( NULL , 'think' , NULL , 'were' , NULL ) , ( 9 , 'l' , 'c' , 3 , REPEAT( 'geysrdfvbrzylcdzkfrqpihyshimervydbi' , 5 ) ) , ( NULL , NULL , NULL , 'h' , 'w' );
++Warnings:
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f1' cannot be null
++Warning       1048    Column 'f2' cannot be null
++Warning       1048    Column 'f3' cannot be null
++Warning       1048    Column 'f4' cannot be null
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f1' cannot be null
++Warning       1048    Column 'f2' cannot be null
++Warning       1301    Result of repeat() was larger than max_allowed_packet (1048576) - truncated
++Warning       1048    Column 'f3' cannot be null
++Warning       1048    Column 'f1' cannot be null
++Warning       1048    Column 'f3' cannot be null
++Warning       1048    Column 'f1' cannot be null
++Warning       1048    Column 'f2' cannot be null
++Warning       1048    Column 'f3' cannot be null
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++UPDATE local_1_1 SET f5 = REPEAT ('X', 215566);
++Warnings:
++Warning       1265    Data truncated for column 'f5' at row 1
++Warning       1265    Data truncated for column 'f5' at row 2
++Warning       1265    Data truncated for column 'f5' at row 3
++Warning       1265    Data truncated for column 'f5' at row 4
++Warning       1265    Data truncated for column 'f5' at row 5
++Warning       1265    Data truncated for column 'f5' at row 6
++Warning       1265    Data truncated for column 'f5' at row 7
++Warning       1265    Data truncated for column 'f5' at row 8
++Warning       1265    Data truncated for column 'f5' at row 9
++Warning       1265    Data truncated for column 'f5' at row 10
++Warning       1265    Data truncated for column 'f5' at row 11
++Warning       1265    Data truncated for column 'f5' at row 12
++Warning       1265    Data truncated for column 'f5' at row 13
++Warning       1265    Data truncated for column 'f5' at row 14
++Warning       1265    Data truncated for column 'f5' at row 15
++Warning       1265    Data truncated for column 'f5' at row 16
++Warning       1265    Data truncated for column 'f5' at row 17
++Warning       1265    Data truncated for column 'f5' at row 18
++Warning       1265    Data truncated for column 'f5' at row 19
++Warning       1265    Data truncated for column 'f5' at row 20
++Warning       1265    Data truncated for column 'f5' at row 21
++Warning       1265    Data truncated for column 'f5' at row 22
++Warning       1265    Data truncated for column 'f5' at row 23
++Warning       1265    Data truncated for column 'f5' at row 24
++Warning       1265    Data truncated for column 'f5' at row 25
++Warning       1265    Data truncated for column 'f5' at row 26
++Warning       1265    Data truncated for column 'f5' at row 27
++Warning       1265    Data truncated for column 'f5' at row 28
++Warning       1265    Data truncated for column 'f5' at row 29
++Warning       1265    Data truncated for column 'f5' at row 30
++Warning       1265    Data truncated for column 'f5' at row 31
++Warning       1265    Data truncated for column 'f5' at row 32
++Warning       1265    Data truncated for column 'f5' at row 33
++Warning       1265    Data truncated for column 'f5' at row 34
++Warning       1265    Data truncated for column 'f5' at row 35
++Warning       1265    Data truncated for column 'f5' at row 36
++Warning       1265    Data truncated for column 'f5' at row 37
++Warning       1265    Data truncated for column 'f5' at row 38
++Warning       1265    Data truncated for column 'f5' at row 39
++Warning       1265    Data truncated for column 'f5' at row 40
++Warning       1265    Data truncated for column 'f5' at row 41
++Warning       1265    Data truncated for column 'f5' at row 42
++Warning       1265    Data truncated for column 'f5' at row 43
++Warning       1265    Data truncated for column 'f5' at row 44
++Warning       1265    Data truncated for column 'f5' at row 45
++Warning       1265    Data truncated for column 'f5' at row 46
++Warning       1265    Data truncated for column 'f5' at row 47
++Warning       1265    Data truncated for column 'f5' at row 48
++Warning       1265    Data truncated for column 'f5' at row 49
++Warning       1265    Data truncated for column 'f5' at row 50
++Warning       1265    Data truncated for column 'f5' at row 51
++Warning       1265    Data truncated for column 'f5' at row 52
++Warning       1265    Data truncated for column 'f5' at row 53
++Warning       1265    Data truncated for column 'f5' at row 54
++Warning       1265    Data truncated for column 'f5' at row 55
++Warning       1265    Data truncated for column 'f5' at row 56
++Warning       1265    Data truncated for column 'f5' at row 57
++Warning       1265    Data truncated for column 'f5' at row 58
++Warning       1265    Data truncated for column 'f5' at row 59
++Warning       1265    Data truncated for column 'f5' at row 60
++Warning       1265    Data truncated for column 'f5' at row 61
++Warning       1265    Data truncated for column 'f5' at row 62
++Warning       1265    Data truncated for column 'f5' at row 63
++Warning       1265    Data truncated for column 'f5' at row 64
++DROP TABLE local_1_1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug784464.result
+@@ -0,0 +1,58 @@
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC      
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=33 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++ERROR 42000: Incorrect usage/placement of 'key_block_size'
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=34 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Dynamic 0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=34    
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=123 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Dynamic 0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=123   
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=1000 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=1000  
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC      
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=33 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++ERROR 42000: Incorrect usage/placement of 'key_block_size'
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=34 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Dynamic 0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=34    
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=121 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Dynamic 0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=121   
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=1000 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=1000  
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug784464_32bit.result
+@@ -0,0 +1,12 @@
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=124 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Dynamic 0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=124   
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=122 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Dynamic 0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=122   
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug784464_64bit.result
+@@ -0,0 +1,12 @@
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=124 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=124   
++DROP TABLE t1;
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++PRIMARY KEY (f1)) KEY_BLOCK_SIZE=122 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       X       0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC KEY_BLOCK_SIZE=122   
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug784468.result
+@@ -0,0 +1,15 @@
++CREATE TABLE t1 ( f1 VARCHAR(30)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       32      0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC      
++DROP TABLE t1;
++CREATE TABLE t1 ( f1 VARCHAR(31)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       33      0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC      
++DROP TABLE t1;
++CREATE TABLE t1 ( f1 VARCHAR(32)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++SHOW TABLE STATUS LIKE 't1';
++Name  Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
++t1    MEMORY  10      Fixed   0       34      0       X       0       0       NULL    X       X       NULL    latin1_swedish_ci       NULL    row_format=DYNAMIC      
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug788544.result
+@@ -0,0 +1,9 @@
++CREATE TABLE t1 (f2 VARCHAR (32), f4 LONGBLOB, f5 TEXT) ENGINE=HEAP;
++INSERT INTO t1 VALUES ('a', NULL, NULL),
++('b' , REPEAT('a' , 593338), REPEAT('a', 800));
++UPDATE t1 SET f2 = 'c' WHERE f4 = 'd';
++SELECT LENGTH(f2), LENGTH(f4), LENGTH(f5) FROM t1;
++LENGTH(f2)    LENGTH(f4)      LENGTH(f5)
++1     NULL    NULL
++1     593338  800
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug788576.result
+@@ -0,0 +1,19 @@
++CREATE TABLE t1 (f1 VARCHAR (32), f2 VARCHAR (128), f3 VARBINARY (128),
++f4 VARBINARY (512), f5 VARBINARY (1024),
++KEY (f2(1))) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++INSERT IGNORE INTO t1 VALUES (2, NULL, 6, REPEAT('glugcgqk', 5), 'look'),
++(REPEAT( 'kglugcgqkin', 6), 'if', 'was', NULL, NULL),
++(NULL, NULL, NULL, NULL, 7);
++Warnings:
++Warning       1265    Data truncated for column 'f1' at row 2
++SELECT * FROM t1;
++f1    f2      f3      f4      f5
++2     NULL    6       glugcgqkglugcgqkglugcgqkglugcgqkglugcgqk        look
++kglugcgqkinkglugcgqkinkglugcgqki      if      was     NULL    NULL
++NULL  NULL    NULL    NULL    7
++DELETE FROM t1 WHERE f5 <=> NULL;
++SELECT * FROM t1;
++f1    f2      f3      f4      f5
++2     NULL    6       glugcgqkglugcgqkglugcgqkglugcgqkglugcgqk        look
++NULL  NULL    NULL    NULL    7
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug788722.result
+@@ -0,0 +1,18 @@
++CREATE TABLE IF NOT EXISTS local_1_1 (f1 VARCHAR (32) NOT NULL,
++f2 VARCHAR (128) NOT NULL,
++f3 BLOB NOT NULL,
++f4 TEXT,
++f5 BLOB (1024),
++PRIMARY KEY (f1),
++KEY (f1 , f2)
++) ENGINE=HEAP ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE = 2048;
++INSERT IGNORE INTO local_1_1 VALUES
++(REPEAT('egqeqfxwaejpqixuvvtentruyqadxiybjdfqjspfbyjdjczrrwjnagkzsoagatqookhsgtrvvbxacppljfzaseidqggxvuirm' , 5), NULL, NULL, NULL, REPEAT('hegqeqfxwaejpqixuvvtentruyqadxiy', 1)),
++('you', NULL, 0, REPEAT("X", 2048) , 0);
++Warnings:
++Warning       1265    Data truncated for column 'f1' at row 1
++Warning       1048    Column 'f2' cannot be null
++Warning       1048    Column 'f3' cannot be null
++Warning       1048    Column 'f2' cannot be null
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++DROP TABLE local_1_1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_bug789131.result
+@@ -0,0 +1,7 @@
++CREATE TABLE t1 (f1 VARCHAR (128), f2 VARCHAR (128), f3 VARBINARY (512),
++f4 TEXT (65525), f5 VARCHAR (128), KEY (f1(1))) ENGINE=HEAP;
++INSERT IGNORE INTO t1 VALUES 
++( 'o' , "" , NULL , "" , 0 ) , 
++(NULL, "" , "" , "" , 'f' ) ;
++INSERT IGNORE INTO t1 SELECT * FROM t1;
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/r/percona_heap_var.result
+@@ -0,0 +1,194 @@
++drop table if exists t1;
++set @@session.max_heap_table_size=16*1024*1024;
++create table t1 (a int not null, b varchar(400), c int, primary key (a), key (c)) engine=heap comment="testing heaps" key_block_size=128;
++ERROR 42000: Incorrect usage/placement of 'key_block_size'
++create table t1 (a int not null, b int, c varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" key_block_size=4;
++ERROR 42000: Incorrect usage/placement of 'key_block_size'
++create table t1 (a int not null, b int, c varchar(400), d varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" key_block_size=24;
++show table status like "t1";
++Name  t1
++Engine        MEMORY
++Version       10
++Row_format    Dynamic
++Rows  0
++Avg_row_length        X
++Data_length   X
++Max_data_length       X
++Index_length  X
++Data_free     X
++Auto_increment        X
++Create_time   X
++Update_time   X
++Check_time    X
++Collation     latin1_swedish_ci
++Checksum      NULL
++Create_options        KEY_BLOCK_SIZE=24
++Comment       testing heaps
++insert into t1 values (1,1,'012',NULL), (2,2,'0123456789',NULL), (3,3,'012345678901234567890123456789',NULL), (4,4,NULL,'0123456789012345678901234567890123456789012345678901234567890123456789');
++select * from t1;
++a     b       c       d
++1     1       012     NULL
++2     2       0123456789      NULL
++3     3       012345678901234567890123456789  NULL
++4     4       NULL    0123456789012345678901234567890123456789012345678901234567890123456789
++delete from t1 where a = 3;
++select * from t1;
++a     b       c       d
++1     1       012     NULL
++2     2       0123456789      NULL
++4     4       NULL    0123456789012345678901234567890123456789012345678901234567890123456789
++insert into t1 values (5,5,NULL,'0123'), (6,6,NULL,'0123');
++select * from t1;
++a     b       c       d
++1     1       012     NULL
++2     2       0123456789      NULL
++6     6       NULL    0123
++5     5       NULL    0123
++4     4       NULL    0123456789012345678901234567890123456789012345678901234567890123456789
++update t1 set c = '012345678901234567890123456789' where a = 2;
++select * from t1;
++a     b       c       d
++1     1       012     NULL
++2     2       012345678901234567890123456789  NULL
++6     6       NULL    0123
++5     5       NULL    0123
++4     4       NULL    0123456789012345678901234567890123456789012345678901234567890123456789
++update t1 set c = '0123456789' where a = 2;
++select * from t1;
++a     b       c       d
++1     1       012     NULL
++2     2       0123456789      NULL
++6     6       NULL    0123
++5     5       NULL    0123
++4     4       NULL    0123456789012345678901234567890123456789012345678901234567890123456789
++insert into t1 values (7,7,'0123',NULL), (8,8,'0123',NULL);
++select * from t1;
++a     b       c       d
++1     1       012     NULL
++2     2       0123456789      NULL
++6     6       NULL    0123
++5     5       NULL    0123
++4     4       NULL    0123456789012345678901234567890123456789012345678901234567890123456789
++7     7       0123    NULL
++8     8       0123    NULL
++show table status like "t1";
++Name  t1
++Engine        MEMORY
++Version       10
++Row_format    Dynamic
++Rows  7
++Avg_row_length        X
++Data_length   X
++Max_data_length       X
++Index_length  X
++Data_free     X
++Auto_increment        X
++Create_time   X
++Update_time   X
++Check_time    X
++Collation     latin1_swedish_ci
++Checksum      NULL
++Create_options        KEY_BLOCK_SIZE=24
++Comment       testing heaps
++alter table t1 key_block_size = 0;
++show table status like "t1";
++Name  t1
++Engine        MEMORY
++Version       10
++Row_format    Dynamic
++Rows  7
++Avg_row_length        X
++Data_length   X
++Max_data_length       X
++Index_length  X
++Data_free     X
++Auto_increment        X
++Create_time   X
++Update_time   X
++Check_time    X
++Collation     latin1_swedish_ci
++Checksum      NULL
++Create_options        
++Comment       testing heaps
++alter table t1 row_format = dynamic;
++show table status like "t1";
++Name  t1
++Engine        MEMORY
++Version       10
++Row_format    Dynamic
++Rows  7
++Avg_row_length        X
++Data_length   X
++Max_data_length       X
++Index_length  X
++Data_free     X
++Auto_increment        X
++Create_time   X
++Update_time   X
++Check_time    X
++Collation     latin1_swedish_ci
++Checksum      NULL
++Create_options        row_format=DYNAMIC KEY_BLOCK_SIZE=X
++Comment       testing heaps
++alter table t1 key_block_size = 128, max_rows = 10001;
++show table status like "t1";
++Name  t1
++Engine        MEMORY
++Version       10
++Row_format    Dynamic
++Rows  7
++Avg_row_length        X
++Data_length   X
++Max_data_length       X
++Index_length  X
++Data_free     X
++Auto_increment        X
++Create_time   X
++Update_time   X
++Check_time    X
++Collation     latin1_swedish_ci
++Checksum      NULL
++Create_options        max_rows=10001 row_format=DYNAMIC KEY_BLOCK_SIZE=128
++Comment       testing heaps
++select * from t1;
++a     b       c       d
++1     1       012     NULL
++2     2       0123456789      NULL
++6     6       NULL    0123
++5     5       NULL    0123
++4     4       NULL    0123456789012345678901234567890123456789012345678901234567890123456789
++7     7       0123    NULL
++8     8       0123    NULL
++delete from t1;
++select * from t1;
++a     b       c       d
++call mtr.add_suppression("The table 't1' is full");
++select count(*) from t1;
++count(*)
++10001
++insert into t1 values (100000,100000,NULL,'0123'), (100000,100000,NULL,'0123');
++ERROR HY000: The table 't1' is full
++show table status like "t1";
++Name  t1
++Engine        MEMORY
++Version       10
++Row_format    Dynamic
++Rows  10001
++Avg_row_length        X
++Data_length   X
++Max_data_length       X
++Index_length  X
++Data_free     X
++Auto_increment        X
++Create_time   X
++Update_time   X
++Check_time    X
++Collation     latin1_swedish_ci
++Checksum      NULL
++Create_options        max_rows=10001 row_format=DYNAMIC KEY_BLOCK_SIZE=128
++Comment       testing heaps
++select count(*) from t1;
++count(*)
++10001
++set @@session.max_heap_table_size=default;
++drop table t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_blob.test
+@@ -0,0 +1,642 @@
++########################################################################
++# Test blobs with the HEAP/MEMORY storage engine
++########################################################################
++
++########################################################################
++# Modified tests from type_blob.test
++########################################################################
++
++SET @old_default_storage_engine=@@default_storage_engine;
++SET default_storage_engine=MEMORY;
++
++#
++# Basic cleanup
++#
++--disable_warnings
++drop table if exists t1,t2,t3,t4,t5,t6,t7;
++--enable_warnings
++
++
++#
++# Check syntax for creating BLOB/TEXT
++#
++
++CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
++show columns from t1;
++# PS doesn't give errors on prepare yet
++CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000));
++CREATE TABLE t4 (c varchar(65530) character set utf8 not null);
++show columns from t2;
++create table t3 (a long, b long byte);
++show create TABLE t3;
++show create TABLE t4;
++drop table t1,t2,t3,t4;
++
++#
++# Check errors with blob
++#
++
++--error 1074
++CREATE TABLE t1 (a char(257) default "hello");
++--error 1074
++CREATE TABLE t2 (a char(256));
++--error 1074
++CREATE TABLE t1 (a varchar(70000) default "hello");
++--error 1101
++CREATE TABLE t2 (a blob default "hello");
++
++# Safety to be able to continue with other tests if above fails
++--disable_warnings
++drop table if exists t1,t2;
++--enable_warnings
++
++#
++# test of full join with blob
++#
++
++create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
++insert into t1 values (null,"a","A");
++insert into t1 values (null,"bbb","BBB");
++insert into t1 values (null,"ccc","CCC");
++select last_insert_id();
++select * from t1,t1 as t2;
++
++drop table t1;
++
++#
++# Test of changing TEXT column
++#
++
++create table t1 (a text);
++insert into t1 values ('where');
++update t1 set a='Where'; 
++select * from t1;
++drop table t1;
++
++#
++# test of blob, text, char and varbinary
++#
++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");
++insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
++insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
++insert into t1 values ("a","a","a","a");
++insert into t1 values (1,1,1,1);
++insert into t1 values (NULL,NULL,NULL,NULL);
++update t1 set c="",b=null where c="1";
++
++lock tables t1 READ;
++# We mask out the Privileges column because it differs for embedded server
++--replace_column 8 #
++show full fields from t1;
++lock tables t1 WRITE;
++--replace_column 8 #
++show full fields from t1;
++unlock tables;
++
++select t from t1 where t like "hello";
++select c from t1 where c like "hello";
++select b from t1 where b like "hello";
++select d from t1 where d like "hello";
++select c from t1 having c like "hello";
++select d from t1 having d like "hello";
++select t from t1 where t like "%HELLO%";
++select c from t1 where c like "%HELLO%";
++select b from t1 where b like "%HELLO%";
++select d from t1 where d like "%HELLO%";
++select c from t1 having c like "%HELLO%";
++select d from t1 having d like "%HELLO%";
++select d from t1 having d like "%HE%LLO%";
++select t from t1 order by t;
++select c from t1 order by c;
++select b from t1 order by b;
++select d from t1 order by d;
++select distinct t from t1;
++select distinct b from t1;
++select distinct t from t1 order by t;
++select distinct b from t1 order by b;
++select t from t1 group by t;
++select b from t1 group by b;
++set option sql_big_tables=1;
++select distinct t from t1;
++select distinct b from t1;
++select distinct t from t1 order by t;
++select distinct b from t1 order by b;
++select distinct c from t1;
++select distinct d from t1;
++select distinct c from t1 order by c;
++select distinct d from t1 order by d;
++select c from t1 group by c;
++select d from t1 group by d;
++set option sql_big_tables=0;
++select distinct * from t1;
++select t,count(*) from t1 group by t;
++select b,count(*) from t1 group by b;
++select c,count(*) from t1 group by c;
++select d,count(*) from t1 group by d;
++drop table t1;
++
++
++#
++# Test of join with blobs and min
++#
++
++CREATE TABLE t1 (
++  t1_id bigint(21) NOT NULL auto_increment,
++  _field_72 varchar(128) DEFAULT '' NOT NULL,
++  _field_95 varchar(32),
++  _field_115 tinyint(4) DEFAULT '0' NOT NULL,
++  _field_122 tinyint(4) DEFAULT '0' NOT NULL,
++  _field_126 tinyint(4),
++  _field_134 tinyint(4),
++  PRIMARY KEY (t1_id),
++  UNIQUE _field_72 (_field_72),
++  KEY _field_115 (_field_115),
++  KEY _field_122 (_field_122)
++);
++
++
++INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
++INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
++INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
++
++
++CREATE TABLE t2 (
++  seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++  seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++  PRIMARY KEY (seq_0_id,seq_1_id)
++);
++
++
++INSERT INTO t2 VALUES (1,1);
++INSERT INTO t2 VALUES (2,1);
++INSERT INTO t2 VALUES (2,2);
++
++CREATE TABLE t3 (
++  t3_id bigint(21) NOT NULL auto_increment,
++  _field_131 varchar(128),
++  _field_133 tinyint(4) DEFAULT '0' NOT NULL,
++  _field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
++  _field_137 tinyint(4),
++  _field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
++  _field_140 blob,
++  _field_142 tinyint(4) DEFAULT '0' NOT NULL,
++  _field_145 tinyint(4) DEFAULT '0' NOT NULL,
++  _field_148 tinyint(4) DEFAULT '0' NOT NULL,
++  PRIMARY KEY (t3_id),
++  KEY _field_133 (_field_133),
++  KEY _field_135 (_field_135),
++  KEY _field_139 (_field_139),
++  KEY _field_142 (_field_142),
++  KEY _field_145 (_field_145),
++  KEY _field_148 (_field_148)
++);
++
++
++INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
++INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
++
++
++CREATE TABLE t4 (
++  seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++  seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++  PRIMARY KEY (seq_0_id,seq_1_id)
++);
++
++
++INSERT INTO t4 VALUES (1,1);
++INSERT INTO t4 VALUES (2,1);
++
++CREATE TABLE t5 (
++  t5_id bigint(21) NOT NULL auto_increment,
++  _field_149 tinyint(4),
++  _field_156 varchar(128) DEFAULT '' NOT NULL,
++  _field_157 varchar(128) DEFAULT '' NOT NULL,
++  _field_158 varchar(128) DEFAULT '' NOT NULL,
++  _field_159 varchar(128) DEFAULT '' NOT NULL,
++  _field_160 varchar(128) DEFAULT '' NOT NULL,
++  _field_161 varchar(128) DEFAULT '' NOT NULL,
++  PRIMARY KEY (t5_id),
++  KEY _field_156 (_field_156),
++  KEY _field_157 (_field_157),
++  KEY _field_158 (_field_158),
++  KEY _field_159 (_field_159),
++  KEY _field_160 (_field_160),
++  KEY _field_161 (_field_161)
++);
++
++
++INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
++INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
++
++CREATE TABLE t6 (
++  seq_0_id bigint(21) DEFAULT '0' NOT NULL,
++  seq_1_id bigint(21) DEFAULT '0' NOT NULL,
++  PRIMARY KEY (seq_0_id,seq_1_id)
++);
++
++INSERT INTO t6 VALUES (1,1);
++INSERT INTO t6 VALUES (1,2);
++INSERT INTO t6 VALUES (2,2);
++
++CREATE TABLE t7 (
++  t7_id bigint(21) NOT NULL auto_increment,
++  _field_143 tinyint(4),
++  _field_165 varchar(32),
++  _field_166 smallint(6) DEFAULT '0' NOT NULL,
++  PRIMARY KEY (t7_id),
++  KEY _field_166 (_field_166)
++);
++
++
++INSERT INTO t7 VALUES (1,0,'High',1);
++INSERT INTO t7 VALUES (2,0,'Medium',2);
++INSERT INTO t7 VALUES (3,0,'Low',3);
++
++select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
++
++drop table t1,t2,t3,t4,t5,t6,t7;
++
++#
++# Test of reverse with empty blob
++#
++
++create table t1 (a blob);
++insert into t1 values ("empty"),("");
++select a,reverse(a) from t1;
++drop table t1;
++
++#
++# Bug when blob is updated
++#
++
++create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
++insert into t1 (id) values (1);
++# We have to clean up the path in the results for safe comparison
++eval select
++  charset(load_file('../../std_data/words.dat')),
++  collation(load_file('../../std_data/words.dat')),
++  coercibility(load_file('../../std_data/words.dat'));
++--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
++eval explain extended select
++  charset(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')),
++  collation(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')),
++  coercibility(load_file('$MYSQLTEST_VARDIR/std_data/words.dat'));
++--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
++eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data/words.dat') where id=1;
++select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
++drop table t1;
++--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
++eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data/words.dat') l;
++# We mask out the Privileges column because it differs for embedded server
++--replace_column 8 #
++show full fields from t1;
++drop table t1;
++
++#
++# Test blob's with end space (Bug #1651)
++# This is a bit changed since we now have true varchar
++#
++
++create table t1 (id integer primary key auto_increment, txt text not null);
++insert into t1 (txt) values ('Chevy ');
++select * from t1 where txt='Chevy';
++select * from t1 where txt='Chevy ';
++select * from t1 where txt='Chevy ' or txt='Chevy';
++select * from t1 where txt='Chevy' or txt='Chevy ';
++select * from t1 where id='1' or id='2';
++insert into t1 (txt) values('Ford');
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
++select * from t1 where txt='Chevy' or txt='Chevy ';
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
++select * from t1 where txt in ('Chevy ','Chevy');
++select * from t1 where txt in ('Chevy');
++select * from t1 where txt between 'Chevy' and 'Chevy';
++select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
++select * from t1 where txt between 'Chevy' and 'Chevy ';
++select * from t1 where txt < 'Chevy ';
++select * from t1 where txt <= 'Chevy';
++select * from t1 where txt > 'Chevy';
++select * from t1 where txt >= 'Chevy';
++drop table t1;
++
++create table t1 (id integer primary key auto_increment, txt text);
++insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
++select * from t1 where txt='Chevy' or txt is NULL;
++explain select * from t1 where txt='Chevy' or txt is NULL;
++select * from t1 where txt='Chevy ';
++select * from t1 where txt='Chevy ' or txt='Chevy';
++select * from t1 where txt='Chevy' or txt='Chevy ';
++select * from t1 where id='1' or id='2';
++insert into t1 (txt) values('Ford');
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
++select * from t1 where txt='Chevy' or txt='Chevy ';
++select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
++select * from t1 where txt in ('Chevy ','Chevy');
++select * from t1 where txt in ('Chevy');
++select * from t1 where txt between 'Chevy' and 'Chevy';
++select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
++select * from t1 where txt between 'Chevy' and 'Chevy ';
++select * from t1 where txt < 'Chevy ';
++select * from t1 where txt < 'Chevy ' or txt is NULL;
++select * from t1 where txt <= 'Chevy';
++select * from t1 where txt > 'Chevy';
++select * from t1 where txt >= 'Chevy';
++alter table t1 modify column txt blob;
++explain select * from t1 where txt='Chevy' or txt is NULL;
++select * from t1 where txt='Chevy' or txt is NULL;
++explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
++select * from t1 where txt='Chevy' or txt is NULL order by txt;
++drop table t1;
++
++CREATE TABLE t1 ( i int(11) NOT NULL default '0',    c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY  (i));
++INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
++select max(i) from t1 where c = '';
++drop table t1;
++
++# End of 4.1 tests
++
++#
++# Test that blob's and varbinary are sorted according to length
++#
++
++CREATE table t1 (a blob);
++insert into t1 values ('b'),('a\0'),('a'),('a '),('aa'),(NULL);
++select hex(a) from t1 order by a;
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++alter table t1 modify a varbinary(5);
++select hex(a) from t1 order by a;
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++alter table t1 modify a char(5);
++select hex(a) from t1 order by a;
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++alter table t1 modify a binary(5);
++select hex(a) from t1 order by a;
++select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
++drop table t1;
++
++#
++# Bug #19489: Inconsistent support for DEFAULT in TEXT columns
++#
++create table t1 (a text default '');
++show create table t1;
++insert into t1 values (default);
++select * from t1;
++drop table t1;
++set @@sql_mode='TRADITIONAL';
++--error ER_BLOB_CANT_HAVE_DEFAULT
++create table t1 (a text default '');
++set @@sql_mode='';
++
++#
++# Bug #32282: TEXT silently truncates when value is exactly 65536 bytes
++#
++
++CREATE TABLE t (c TEXT CHARSET ASCII);
++INSERT INTO t (c) VALUES (REPEAT('1',65537));
++INSERT INTO t (c) VALUES (REPEAT('2',65536));
++INSERT INTO t (c) VALUES (REPEAT('3',65535));
++SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
++DROP TABLE t;
++# Bug#15776: 32-bit signed int used for length of blob
++# """LONGBLOB:  A BLOB column with a maximum length of 4,294,967,295 or 4GB."""
++#
++# Conditions should be in this order:
++# A size is not in the allowed bounds.
++# If the type is char-ish AND size is within the max blob size:
++#   raise ER_TOO_BIG_FIELDLENGTH  (suggest using BLOB)
++# If size is too small:
++#   raise ER_PARSE_ERROR
++# raise ER_TOO_BIG_DISPLAYWIDTH
++
++# BLOB and TEXT types
++--disable_warnings
++drop table if exists b15776;
++--enable_warnings
++create table b15776 (data blob(2147483647));
++drop table b15776;
++--error ER_PARSE_ERROR
++create table b15776 (data blob(-1));
++create table b15776 (data blob(2147483648));
++drop table b15776;
++create table b15776 (data blob(4294967294));
++drop table b15776;
++create table b15776 (data blob(4294967295));
++drop table b15776;
++--error ER_TOO_BIG_DISPLAYWIDTH
++create table b15776 (data blob(4294967296));
++
++CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) );
++show columns from b15776;
++drop table b15776;
++
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a blob(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a text(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++
++# Int types
++# "Another extension is supported by MySQL for optionally specifying the
++# display width of integer data types in parentheses following the base keyword
++# for the type (for example, INT(4)). This optional display width is used to
++# display integer values having a width less than the width specified for the
++# column by left-padding them with spaces."   ยง Numeric Types
++CREATE TABLE b15776 (a int(0)); # 0 is special case, means default size
++INSERT INTO b15776 values (NULL), (1), (42), (654);
++SELECT * from b15776 ORDER BY a;
++DROP TABLE b15776;
++--error ER_PARSE_ERROR
++CREATE TABLE b15776 (a int(-1));
++CREATE TABLE b15776 (a int(255));
++DROP TABLE b15776;
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a int(256));
++--error ER_PARSE_ERROR
++CREATE TABLE b15776 (data blob(-1));
++
++# Char types
++# Recommend BLOB
++--error ER_TOO_BIG_FIELDLENGTH
++CREATE TABLE b15776 (a char(2147483647));
++--error ER_TOO_BIG_FIELDLENGTH
++CREATE TABLE b15776 (a char(2147483648));
++--error ER_TOO_BIG_FIELDLENGTH
++CREATE TABLE b15776 (a char(4294967295));
++# Even BLOB won't hold
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a char(4294967296));
++
++
++# Other numeric-ish types
++## For year, widths not "2" or "4" are silently rewritten to "4".  But
++## When we complain about it, we say that the max is 255.  We may be 
++## talking about different things.  It's confusing.
++CREATE TABLE b15776 (a year(4294967295));
++INSERT INTO b15776 VALUES (42);
++SELECT * FROM b15776;
++DROP TABLE b15776;
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a year(4294967296));
++CREATE TABLE b15776 (a year(0));  # 0 is special case, means default size
++DROP TABLE b15776;
++--error ER_PARSE_ERROR
++CREATE TABLE b15776 (a year(-2));
++
++
++# We've already tested the case, but this should visually show that 
++# widths that are too large to be interpreted cause DISPLAYWIDTH errors.
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++--error ER_TOO_BIG_DISPLAYWIDTH
++CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++
++## Do not select, too much memory needed.
++CREATE TABLE b15776 select cast(null as char(4294967295));
++show columns from b15776;
++drop table b15776;
++CREATE TABLE b15776 select cast(null as nchar(4294967295));
++show columns from b15776;
++drop table b15776;
++CREATE TABLE b15776 select cast(null as binary(4294967295));
++show columns from b15776;
++drop table b15776;
++
++explain select cast(1 as char(4294967295));
++explain select cast(1 as nchar(4294967295));
++explain select cast(1 as binary(4294967295));
++
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select cast(1 as char(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select cast(1 as nchar(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select cast(1 as binary(4294967296));
++
++--error ER_PARSE_ERROR
++explain select cast(1 as decimal(-1));
++explain select cast(1 as decimal(64, 30));
++# It's not as important which errors are raised for these, since the 
++# limit is nowhere near 2**32.  We may fix these eventually to take
++# 4294967295 and still reject it because it's greater than 64 or 30, 
++# but that's not a high priority and the parser needn't worry about 
++# such a weird case.
++--error ER_TOO_BIG_SCALE,ER_PARSE_ERROR
++explain select cast(1 as decimal(64, 999999999999999999999999999999));
++--error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
++explain select cast(1 as decimal(4294967296));
++--error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
++explain select cast(1 as decimal(999999999999999999999999999999999999));
++
++explain select convert(1, char(4294967295));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, char(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++explain select convert(1, nchar(4294967295));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, nchar(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++explain select convert(1, binary(4294967295));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, binary(4294967296));
++--error ER_TOO_BIG_DISPLAYWIDTH
++explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
++
++--echo End of 5.0 tests
++
++#
++# Bug #33969: Updating a text field via a left join
++#
++
++CREATE TABLE t1(id INT NOT NULL);
++CREATE TABLE t2(id INT NOT NULL, c TEXT NOT NULL);
++
++INSERT INTO t1 VALUES (1);
++INSERT INTO t2 VALUES (1, '');
++
++UPDATE t2 SET c = REPEAT('1', 70000);
++SELECT LENGTH(c) FROM t2;
++
++UPDATE t1 LEFT JOIN t2 USING(id) SET t2.c = REPEAT('1', 70000) WHERE t1.id = 1;
++SELECT LENGTH(c) FROM t2;
++
++DROP TABLE t1, t2;
++
++--echo # Bug #52160: crash and inconsistent results when grouping
++--echo #             by a function and column
++
++CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
++
++CREATE TABLE t1(a CHAR(1));
++INSERT INTO t1 VALUES ('0'), ('0');
++
++SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
++
++DROP FUNCTION f1;
++DROP TABLE t1;
++
++
++
++
++
++########################################################################
++# Modified test from myisam-blob.test
++########################################################################
++
++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;
++
++connect(con1, localhost, root,,);
++connection con1;
++
++--disable_warnings
++drop table if exists t1;
++--enable_warnings
++
++# Bug #2159 (Problem with update of blob to > 16M)
++
++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;
++delete from t1 where left(data,1)='a';
++truncate table t1;
++INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
++INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
++delete from t1 where left(data,1)='b';
++
++# now we have two blocks in the table, first is a 1M record and second is
++# a 16M delete block.
++
++UPDATE t1 set data=repeat('c',17*1024*1024);
++delete from t1 where left(data,1)='c';
++
++INSERT INTO t1 set data=repeat('a',18*1024*1024);
++select length(data) from t1;
++alter table t1 modify data blob;
++select length(data) from t1;
++drop table t1;
++
++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;
++drop table t1;
++
++disconnect con1;
++connection default;
++
++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 @@
++#
++# Test for bug lp:783366
++#
++
++--disable_warnings
++drop table if exists t1;
++--enable_warnings
++
++CREATE TABLE t1 (
++        f1 VARCHAR ( 128 ) ,
++        f2 VARCHAR ( 32 ),
++        PRIMARY KEY ( f2 ( 2 ) , f1 )
++)
++ENGINE=HEAP KEY_BLOCK_SIZE = 512;
++INSERT IGNORE INTO t1 VALUES ( 'te' , 'm') , ( NULL , 'think' );
++INSERT IGNORE INTO t1 VALUES ( 'te' , 'm') , ( NULL , 'think' );
++
++DROP TABLE t1;
++
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug783451.test
+@@ -0,0 +1,16 @@
++# Testcase for the bug https://bugs.launchpad.net/percona-projects-qa/+bug/783451
++# With dynamic row format in HEAP and the UPDATE statement that significantly
++# increases the data size, the table scan in-progress desyncs its table position state.
++# Run with Valgrind if it does not crash for you.
++--disable_warnings
++DROP TABLE IF EXISTS local_1_1;
++--enable_warnings
++CREATE  TABLE IF NOT EXISTS local_1_1 ( f1 VARCHAR ( 32 ) NOT NULL  , f2 VARCHAR ( 128 ) NOT NULL DEFAULT 'cboepfaobilcchabvglgjdbynog' , f3 VARCHAR ( 32 ) NOT NULL  , f4 VARBINARY ( 32 ) NOT NULL  , f5 VARBINARY ( 1024 )  DEFAULT 'ycboepfao' , KEY ( f1 /* ( 2 ) */ , f2 /* ( 2 ) */ ) ) ENGINE=HEAP KEY_BLOCK_SIZE = 512;
++INSERT IGNORE INTO local_1_1 VALUES ( REPEAT( 'ervydbimvmbqmsowdbsa' , 1 ) , 'v' , NULL , NULL , REPEAT( 'mervydbimvmbqms' , 5 ) ) , ( 'p' , 6 , 'n' , REPEAT( 'imervydbimvmbqmsowdbs' , 4 ) , 'do' ) , ( NULL , NULL , REPEAT( 'himervydbimvmbqmsowdbsaybudvwaamvhempuublmia' , 6 ) , REPEAT('X', POW(2, 20) * 2) , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT('X', POW(2, 20) * 2) , REPEAT( 'Y' , 763 ) , NULL , REPEAT('X', POW(2, 20) * 2) , NULL ) , ( REPEAT('X', POW(2, 20) * 2) , 'time' , 'how' , 2 , REPEAT( 'Y' , 107 ) ) , ( REPEAT( 'hyshimervydbimvmbqmsowdbsaybud' , 5 ) , 2 , 8 , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( 'come' , NULL , 'i' , NULL , REPEAT('X', POW(2, 20) * 2) );
++INSERT IGNORE INTO local_1_1 VALUES ( 'ok' , NULL , REPEAT( 'Y' , 651 ) , 2 , 5 ) , ( REPEAT( 'zylcdzkfrqpihyshimervydbimvmbqmsowdbsaybu' , 3 ) , REPEAT( 'Y' , 282 ) , REPEAT( 'X' , 0 ) , REPEAT( 'Y' , 369 ) , 'g' ) , ( 'think' , REPEAT('X', POW(2, 20) * 2), NULL , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT( 'Y' , 468 ) , REPEAT( 'dfvbrzylcd' , 6 ) , REPEAT( 'Y' , 264 ) , NULL , 'c' ) , ( NULL , NULL , REPEAT( 'srdfvbrzylcdzkfrqpihyshimervydbimvmbqms' , 0 ) , REPEAT( 'Y' , 244 ) , 7 ) , ( REPEAT( 'Y' , 0 ) , 'how' , 'going' , 'q' , NULL );
++INSERT IGNORE INTO local_1_1 VALUES ( REPEAT('X', POW(2, 20) * 2) , NULL , NULL , NULL , REPEAT('X', POW(2, 20) * 2) ) , ( REPEAT('X', POW(2, 20) * 2) , NULL , REPEAT('X', POW(2, 20) * 2) , 'this' , 'e' ) , ( NULL , 'think' , NULL , 'were' , NULL ) , ( 9 , 'l' , 'c' , 3 , REPEAT( 'geysrdfvbrzylcdzkfrqpihyshimervydbi' , 5 ) ) , ( NULL , NULL , NULL , 'h' , 'w' );
++--enable_warnings
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++UPDATE local_1_1 SET f5 = REPEAT ('X', 215566);
++DROP TABLE local_1_1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug784464.test
+@@ -0,0 +1,66 @@
++#
++# Bug #784464: Silent conversion from Dynamic to Fixed row_format for certain
++# values of key_block_size.
++# Also see percona_heap_bug784464_32bit and percona_heap_bug784464_64bit tests.
++#
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++                      PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++--error ER_CANT_USE_OPTION_HERE
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=33 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=34 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=123 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=1000 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++                      PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++--error ER_CANT_USE_OPTION_HERE
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=33 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=34 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=121 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=1000 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug784464_32bit.test
+@@ -0,0 +1,15 @@
++# 32-bit platform specific parts of tests for LP bug #784464
++
++--source include/have_32bit.inc
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=124 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=122 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug784464_64bit.test
+@@ -0,0 +1,15 @@
++# 64-bit platform specific parts of tests for LP bug #784464
++
++--source include/have_64bit.inc
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=124 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 (f1 VARCHAR(32), f2 VARCHAR(96),
++                      PRIMARY KEY (f1)) KEY_BLOCK_SIZE=122 ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 6 X 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug784468.test
+@@ -0,0 +1,19 @@
++#
++# Bug #784468: Tables with VARCHAR(<31) are created as row_format = Fixed
++#
++
++CREATE TABLE t1 ( f1 VARCHAR(30)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 ( f1 VARCHAR(31)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
++CREATE TABLE t1 ( f1 VARCHAR(32)) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++--replace_column 8 X 12 X 13 X
++SHOW TABLE STATUS LIKE 't1';
++DROP TABLE t1;
++
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug788544.test
+@@ -0,0 +1,15 @@
++#
++# Bug #788544: Valgrind warnings/crash in mysql-55-eb-blobs in
++#              hp_extract_record / hp_process_field_data_to_chunkset
++#
++
++CREATE TABLE t1 (f2 VARCHAR (32), f4 LONGBLOB, f5 TEXT) ENGINE=HEAP;
++
++INSERT INTO t1 VALUES ('a', NULL, NULL),
++                      ('b' , REPEAT('a' , 593338), REPEAT('a', 800));
++
++UPDATE t1 SET f2 = 'c' WHERE f4 = 'd';
++
++SELECT LENGTH(f2), LENGTH(f4), LENGTH(f5) FROM t1;
++
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug788576.test
+@@ -0,0 +1,19 @@
++#
++# Bug #788576: Second crash in hp_movelink with mysql-55-eb
++#
++
++CREATE TABLE t1 (f1 VARCHAR (32), f2 VARCHAR (128), f3 VARBINARY (128),
++                 f4 VARBINARY (512), f5 VARBINARY (1024),
++               KEY (f2(1))) ENGINE=HEAP ROW_FORMAT=DYNAMIC;
++
++INSERT IGNORE INTO t1 VALUES (2, NULL, 6, REPEAT('glugcgqk', 5), 'look'),
++                             (REPEAT( 'kglugcgqkin', 6), 'if', 'was', NULL, NULL),
++                           (NULL, NULL, NULL, NULL, 7);
++
++SELECT * FROM t1;
++
++DELETE FROM t1 WHERE f5 <=> NULL;
++
++SELECT * FROM t1;
++
++DROP TABLE t1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug788722.test
+@@ -0,0 +1,20 @@
++#
++# Bug #788722: Second valgrind warning around hp_extract_record in mysql-55-eb-blobs 
++#
++
++CREATE TABLE IF NOT EXISTS local_1_1 (f1 VARCHAR (32) NOT NULL,
++                                      f2 VARCHAR (128) NOT NULL,
++                                    f3 BLOB NOT NULL,
++                                    f4 TEXT,
++                                    f5 BLOB (1024),
++                                    PRIMARY KEY (f1),
++                                    KEY (f1 , f2)
++) ENGINE=HEAP ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE = 2048;
++
++INSERT IGNORE INTO local_1_1 VALUES
++       (REPEAT('egqeqfxwaejpqixuvvtentruyqadxiybjdfqjspfbyjdjczrrwjnagkzsoagatqookhsgtrvvbxacppljfzaseidqggxvuirm' , 5), NULL, NULL, NULL, REPEAT('hegqeqfxwaejpqixuvvtentruyqadxiy', 1)),
++       ('you', NULL, 0, REPEAT("X", 2048) , 0);
++
++INSERT IGNORE INTO local_1_1 SELECT * FROM local_1_1;
++
++DROP TABLE local_1_1;
+--- /dev/null
++++ b/mysql-test/t/percona_heap_bug789131.test
+@@ -0,0 +1,14 @@
++#
++# Bug #789131: Valgrind warning in MyISAM in mysql-55-eb-blobs
++#
++
++CREATE TABLE t1 (f1 VARCHAR (128), f2 VARCHAR (128), f3 VARBINARY (512),
++                      f4 TEXT (65525), f5 VARCHAR (128), KEY (f1(1))) ENGINE=HEAP;
++
++INSERT IGNORE INTO t1 VALUES 
++       ( 'o' , "" , NULL , "" , 0 ) , 
++       (NULL, "" , "" , "" , 'f' ) ;
++
++INSERT IGNORE INTO t1 SELECT * FROM t1;
++
++DROP TABLE t1;
+\ No newline at end of file
+--- /dev/null
++++ b/mysql-test/t/percona_heap_var.test
+@@ -0,0 +1,85 @@
++#
++# Test heap tables with variable-sized records.
++#
++
++--disable_warnings
++drop table if exists t1;
++--enable_warnings
++
++set @@session.max_heap_table_size=16*1024*1024;
++
++--error 1234
++create table t1 (a int not null, b varchar(400), c int, primary key (a), key (c)) engine=heap comment="testing heaps" key_block_size=128;
++
++--error 1234
++create table t1 (a int not null, b int, c varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" key_block_size=4;
++
++create table t1 (a int not null, b int, c varchar(400), d varchar(400), primary key (a), key (b)) engine=heap comment="testing heaps" key_block_size=24;
++
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++
++insert into t1 values (1,1,'012',NULL), (2,2,'0123456789',NULL), (3,3,'012345678901234567890123456789',NULL), (4,4,NULL,'0123456789012345678901234567890123456789012345678901234567890123456789');
++select * from t1;
++
++delete from t1 where a = 3;
++select * from t1;
++
++insert into t1 values (5,5,NULL,'0123'), (6,6,NULL,'0123');
++select * from t1;
++
++update t1 set c = '012345678901234567890123456789' where a = 2;
++select * from t1;
++
++update t1 set c = '0123456789' where a = 2;
++select * from t1;
++
++insert into t1 values (7,7,'0123',NULL), (8,8,'0123',NULL);
++select * from t1;
++
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++alter table t1 key_block_size = 0;
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++alter table t1 row_format = dynamic;
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--replace_regex /KEY_BLOCK_SIZE=[[:digit:]]+/KEY_BLOCK_SIZE=X/
++--query_vertical show table status like "t1"
++alter table t1 key_block_size = 128, max_rows = 10001;
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++
++select * from t1;
++
++delete from t1;
++select * from t1;
++
++let $1=10001;
++
++call mtr.add_suppression("The table 't1' is full");
++
++disable_query_log;
++
++while ($1) 
++{
++
++  eval insert into t1 values ($1,$1,$1,$1);
++
++  dec $1;
++
++}
++enable_query_log;
++
++select count(*) from t1;
++
++--error 1114
++insert into t1 values (100000,100000,NULL,'0123'), (100000,100000,NULL,'0123');
++
++--replace_column 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
++--query_vertical show table status like "t1"
++select count(*) from t1;
++
++set @@session.max_heap_table_size=default;
++
++drop table t1;
This page took 0.2125 seconds and 4 git commands to generate.