Loading mysql-test/r/innodb.result +11 −72 Original line number Diff line number Diff line Loading @@ -2437,9 +2437,7 @@ a b 20 NULL drop table t1; create table t1 (v varchar(65530), key(v)); Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes drop table t1; ERROR HY000: Can't create table 'test.t1' (errno: 139) create table t1 (v varchar(65536)); Warnings: Note 1246 Converting column 'v' from VARCHAR to TEXT Loading Loading @@ -2579,49 +2577,22 @@ create table t8 (col1 blob, index(col1(767))) character set = latin1 engine = innodb; create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) character set = latin1 engine = innodb; show create table t9; Table Create Table t9 CREATE TABLE `t9` ( `col1` varchar(512) default NULL, `col2` varchar(512) default NULL, KEY `col1` (`col1`,`col2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; create table t1 (col1 varchar(768), index (col1)) character set = latin1 engine = innodb; Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes create table t2 (col1 varbinary(768), index(col1)) ERROR HY000: Can't create table 'test.t1' (errno: 139) create table t2 (col1 varchar(768) primary key) character set = latin1 engine = innodb; Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes create table t3 (col1 text, index(col1(768))) ERROR HY000: Can't create table 'test.t2' (errno: 139) create table t3 (col1 varbinary(768) primary key) character set = latin1 engine = innodb; Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes create table t4 (col1 blob, index(col1(768))) ERROR HY000: Can't create table 'test.t3' (errno: 139) create table t4 (col1 text, index(col1(768))) character set = latin1 engine = innodb; Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `col1` varchar(768) default NULL, KEY `col1` (`col1`(767)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2, t3, t4; create table t1 (col1 varchar(768) primary key) character set = latin1 engine = innodb; ERROR 42000: Specified key was too long; max key length is 767 bytes create table t2 (col1 varbinary(768) primary key) character set = latin1 engine = innodb; ERROR 42000: Specified key was too long; max key length is 767 bytes create table t3 (col1 text, primary key(col1(768))) ERROR HY000: Can't create table 'test.t4' (errno: 139) create table t5 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; ERROR 42000: Specified key was too long; max key length is 767 bytes create table t4 (col1 blob, primary key(col1(768))) character set = latin1 engine = innodb; ERROR 42000: Specified key was too long; max key length is 767 bytes ERROR HY000: Can't create table 'test.t5' (errno: 139) CREATE TABLE t1 ( id INT PRIMARY KEY Loading Loading @@ -2801,38 +2772,6 @@ insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); drop table t1; drop table t2; commit; set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; create table t1(a char(10) primary key, b varchar(20)) engine = innodb; ERROR HY000: Can't create table 'test.t1' (errno: 150) set foreign_key_checks=1; drop table t2; set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; ERROR HY000: Can't create table 'test.t2' (errno: 150) set foreign_key_checks=1; drop table t1; set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; create table t1(a varchar(10) primary key) engine = innodb; alter table t1 modify column a int; Got one of the listed errors set foreign_key_checks=1; drop table t2,t1; set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; alter table t1 convert to character set utf8; set foreign_key_checks=1; drop table t2,t1; set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; rename table t3 to t1; ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150) set foreign_key_checks=1; drop table t2,t3; create table t1 (a varchar(255) character set utf8, b varchar(255) character set utf8, c varchar(255) character set utf8, Loading mysql-test/t/innodb.test +12 −76 Original line number Diff line number Diff line Loading @@ -1356,8 +1356,8 @@ source include/varchar.inc; # Clean up filename -- embedded server reports whole path without .frm, # regular server reports relative path with .frm (argh!) --replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1 --error 1005 create table t1 (v varchar(65530), key(v)); drop table t1; create table t1 (v varchar(65536)); show create table t1; drop table t1; Loading Loading @@ -1485,7 +1485,7 @@ CREATE TEMPORARY TABLE t2 DROP TABLE t1; # # Test that index column max sizes are honored (bug #13315) # Test that index column max sizes are checked (bug #13315) # # prefix index Loading @@ -1512,36 +1512,22 @@ create table t8 (col1 blob, index(col1(767))) create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) character set = latin1 engine = innodb; show create table t9; drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; # these should have their index length trimmed --error 1005 create table t1 (col1 varchar(768), index (col1)) character set = latin1 engine = innodb; create table t2 (col1 varbinary(768), index(col1)) character set = latin1 engine = innodb; create table t3 (col1 text, index(col1(768))) character set = latin1 engine = innodb; create table t4 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; show create table t1; drop table t1, t2, t3, t4; # these should be refused --error 1071 create table t1 (col1 varchar(768) primary key) --error 1005 create table t2 (col1 varchar(768) primary key) character set = latin1 engine = innodb; --error 1071 create table t2 (col1 varbinary(768) primary key) --error 1005 create table t3 (col1 varbinary(768) primary key) character set = latin1 engine = innodb; --error 1071 create table t3 (col1 text, primary key(col1(768))) --error 1005 create table t4 (col1 text, index(col1(768))) character set = latin1 engine = innodb; --error 1071 create table t4 (col1 blob, primary key(col1(768))) --error 1005 create table t5 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; # Loading Loading @@ -1766,56 +1752,6 @@ drop table t1; drop table t2; commit; # tests for bugs #9802 and #13778 # test that FKs between invalid types are not accepted set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; -- error 1005 create table t1(a char(10) primary key, b varchar(20)) engine = innodb; set foreign_key_checks=1; drop table t2; # test that FKs between different charsets are not accepted in CREATE even # when f_k_c is 0 set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; -- error 1005 create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; set foreign_key_checks=1; drop table t1; # test that invalid datatype conversions with ALTER are not allowed set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; create table t1(a varchar(10) primary key) engine = innodb; -- error 1025,1025 alter table t1 modify column a int; set foreign_key_checks=1; drop table t2,t1; # test that charset conversions with ALTER are allowed when f_k_c is 0 set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; alter table t1 convert to character set utf8; set foreign_key_checks=1; drop table t2,t1; # test that RENAME does not allow invalid charsets when f_k_c is 0 set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; -- error 1025 rename table t3 to t1; set foreign_key_checks=1; drop table t2,t3; # # Test that we can create a large (>1K) key # Loading sql/ha_innodb.cc +0 −9 Original line number Diff line number Diff line Loading @@ -2540,12 +2540,6 @@ ha_innobase::open( DBUG_RETURN(0); } uint ha_innobase::max_supported_key_part_length() const { return(DICT_MAX_INDEX_COL_LEN - 1); } /********************************************************************** Closes a handle to an InnoDB table. */ Loading Loading @@ -4704,9 +4698,6 @@ create_index( 0, prefix_len); } /* Even though we've defined max_supported_key_part_length, we still do our own checking using field_lengths to be absolutely sure we don't create too long indexes. */ error = row_create_index_for_mysql(index, trx, field_lengths); error = convert_error_code_to_mysql(error, NULL); Loading sql/ha_innodb.h +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ class ha_innobase: public handler but currently MySQL does not work with keys whose size is > MAX_KEY_LENGTH */ uint max_supported_key_length() const { return 3500; } uint max_supported_key_part_length() const; uint max_supported_key_part_length() const { return 3500; } const key_map *keys_to_use_for_scanning() { return &key_map_full; } bool has_transactions() { return 1;} Loading storage/innobase/btr/btr0sea.c +18 −10 Original line number Diff line number Diff line Loading @@ -904,7 +904,6 @@ btr_search_drop_page_hash_index( ulint* folds; ulint i; mem_heap_t* heap; dict_index_t* index; ulint* offsets; #ifdef UNIV_SYNC_DEBUG Loading Loading @@ -933,16 +932,11 @@ btr_search_drop_page_hash_index( n_fields = block->curr_n_fields; n_bytes = block->curr_n_bytes; index = block->index; /* NOTE: The fields of block must not be accessed after releasing btr_search_latch, as the index page might only be s-latched! */ ut_a(n_fields + n_bytes > 0); rw_lock_s_unlock(&btr_search_latch); ut_a(n_fields + n_bytes > 0); n_recs = page_get_n_recs(page); /* Calculate and cache fold values into an array for fast deletion Loading @@ -955,6 +949,14 @@ btr_search_drop_page_hash_index( rec = page_get_infimum_rec(page); rec = page_rec_get_next(rec); if (!page_rec_is_supremum(rec)) { ut_a(n_fields <= rec_get_n_fields(rec, block->index)); if (n_bytes > 0) { ut_a(n_fields < rec_get_n_fields(rec, block->index)); } } tree_id = btr_page_get_index_id(page); prev_fold = 0; Loading @@ -962,12 +964,18 @@ btr_search_drop_page_hash_index( heap = NULL; offsets = NULL; if (block->index == NULL) { mem_analyze_corruption((byte*)block); ut_a(block->index != NULL); } while (!page_rec_is_supremum(rec)) { /* FIXME: in a mixed tree, not all records may have enough ordering fields: */ offsets = rec_get_offsets(rec, index, offsets, n_fields + (n_bytes > 0), &heap); ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0)); offsets = rec_get_offsets(rec, block->index, offsets, n_fields + (n_bytes > 0), &heap); fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id); if (fold == prev_fold && prev_fold != 0) { Loading Loading
mysql-test/r/innodb.result +11 −72 Original line number Diff line number Diff line Loading @@ -2437,9 +2437,7 @@ a b 20 NULL drop table t1; create table t1 (v varchar(65530), key(v)); Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes drop table t1; ERROR HY000: Can't create table 'test.t1' (errno: 139) create table t1 (v varchar(65536)); Warnings: Note 1246 Converting column 'v' from VARCHAR to TEXT Loading Loading @@ -2579,49 +2577,22 @@ create table t8 (col1 blob, index(col1(767))) character set = latin1 engine = innodb; create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) character set = latin1 engine = innodb; show create table t9; Table Create Table t9 CREATE TABLE `t9` ( `col1` varchar(512) default NULL, `col2` varchar(512) default NULL, KEY `col1` (`col1`,`col2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; create table t1 (col1 varchar(768), index (col1)) character set = latin1 engine = innodb; Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes create table t2 (col1 varbinary(768), index(col1)) ERROR HY000: Can't create table 'test.t1' (errno: 139) create table t2 (col1 varchar(768) primary key) character set = latin1 engine = innodb; Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes create table t3 (col1 text, index(col1(768))) ERROR HY000: Can't create table 'test.t2' (errno: 139) create table t3 (col1 varbinary(768) primary key) character set = latin1 engine = innodb; Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes create table t4 (col1 blob, index(col1(768))) ERROR HY000: Can't create table 'test.t3' (errno: 139) create table t4 (col1 text, index(col1(768))) character set = latin1 engine = innodb; Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `col1` varchar(768) default NULL, KEY `col1` (`col1`(767)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2, t3, t4; create table t1 (col1 varchar(768) primary key) character set = latin1 engine = innodb; ERROR 42000: Specified key was too long; max key length is 767 bytes create table t2 (col1 varbinary(768) primary key) character set = latin1 engine = innodb; ERROR 42000: Specified key was too long; max key length is 767 bytes create table t3 (col1 text, primary key(col1(768))) ERROR HY000: Can't create table 'test.t4' (errno: 139) create table t5 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; ERROR 42000: Specified key was too long; max key length is 767 bytes create table t4 (col1 blob, primary key(col1(768))) character set = latin1 engine = innodb; ERROR 42000: Specified key was too long; max key length is 767 bytes ERROR HY000: Can't create table 'test.t5' (errno: 139) CREATE TABLE t1 ( id INT PRIMARY KEY Loading Loading @@ -2801,38 +2772,6 @@ insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken'); drop table t1; drop table t2; commit; set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; create table t1(a char(10) primary key, b varchar(20)) engine = innodb; ERROR HY000: Can't create table 'test.t1' (errno: 150) set foreign_key_checks=1; drop table t2; set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; ERROR HY000: Can't create table 'test.t2' (errno: 150) set foreign_key_checks=1; drop table t1; set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; create table t1(a varchar(10) primary key) engine = innodb; alter table t1 modify column a int; Got one of the listed errors set foreign_key_checks=1; drop table t2,t1; set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; alter table t1 convert to character set utf8; set foreign_key_checks=1; drop table t2,t1; set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; rename table t3 to t1; ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150) set foreign_key_checks=1; drop table t2,t3; create table t1 (a varchar(255) character set utf8, b varchar(255) character set utf8, c varchar(255) character set utf8, Loading
mysql-test/t/innodb.test +12 −76 Original line number Diff line number Diff line Loading @@ -1356,8 +1356,8 @@ source include/varchar.inc; # Clean up filename -- embedded server reports whole path without .frm, # regular server reports relative path with .frm (argh!) --replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1 --error 1005 create table t1 (v varchar(65530), key(v)); drop table t1; create table t1 (v varchar(65536)); show create table t1; drop table t1; Loading Loading @@ -1485,7 +1485,7 @@ CREATE TEMPORARY TABLE t2 DROP TABLE t1; # # Test that index column max sizes are honored (bug #13315) # Test that index column max sizes are checked (bug #13315) # # prefix index Loading @@ -1512,36 +1512,22 @@ create table t8 (col1 blob, index(col1(767))) create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) character set = latin1 engine = innodb; show create table t9; drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; # these should have their index length trimmed --error 1005 create table t1 (col1 varchar(768), index (col1)) character set = latin1 engine = innodb; create table t2 (col1 varbinary(768), index(col1)) character set = latin1 engine = innodb; create table t3 (col1 text, index(col1(768))) character set = latin1 engine = innodb; create table t4 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; show create table t1; drop table t1, t2, t3, t4; # these should be refused --error 1071 create table t1 (col1 varchar(768) primary key) --error 1005 create table t2 (col1 varchar(768) primary key) character set = latin1 engine = innodb; --error 1071 create table t2 (col1 varbinary(768) primary key) --error 1005 create table t3 (col1 varbinary(768) primary key) character set = latin1 engine = innodb; --error 1071 create table t3 (col1 text, primary key(col1(768))) --error 1005 create table t4 (col1 text, index(col1(768))) character set = latin1 engine = innodb; --error 1071 create table t4 (col1 blob, primary key(col1(768))) --error 1005 create table t5 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; # Loading Loading @@ -1766,56 +1752,6 @@ drop table t1; drop table t2; commit; # tests for bugs #9802 and #13778 # test that FKs between invalid types are not accepted set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; -- error 1005 create table t1(a char(10) primary key, b varchar(20)) engine = innodb; set foreign_key_checks=1; drop table t2; # test that FKs between different charsets are not accepted in CREATE even # when f_k_c is 0 set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; -- error 1005 create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; set foreign_key_checks=1; drop table t1; # test that invalid datatype conversions with ALTER are not allowed set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; create table t1(a varchar(10) primary key) engine = innodb; -- error 1025,1025 alter table t1 modify column a int; set foreign_key_checks=1; drop table t2,t1; # test that charset conversions with ALTER are allowed when f_k_c is 0 set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; alter table t1 convert to character set utf8; set foreign_key_checks=1; drop table t2,t1; # test that RENAME does not allow invalid charsets when f_k_c is 0 set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; -- error 1025 rename table t3 to t1; set foreign_key_checks=1; drop table t2,t3; # # Test that we can create a large (>1K) key # Loading
sql/ha_innodb.cc +0 −9 Original line number Diff line number Diff line Loading @@ -2540,12 +2540,6 @@ ha_innobase::open( DBUG_RETURN(0); } uint ha_innobase::max_supported_key_part_length() const { return(DICT_MAX_INDEX_COL_LEN - 1); } /********************************************************************** Closes a handle to an InnoDB table. */ Loading Loading @@ -4704,9 +4698,6 @@ create_index( 0, prefix_len); } /* Even though we've defined max_supported_key_part_length, we still do our own checking using field_lengths to be absolutely sure we don't create too long indexes. */ error = row_create_index_for_mysql(index, trx, field_lengths); error = convert_error_code_to_mysql(error, NULL); Loading
sql/ha_innodb.h +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ class ha_innobase: public handler but currently MySQL does not work with keys whose size is > MAX_KEY_LENGTH */ uint max_supported_key_length() const { return 3500; } uint max_supported_key_part_length() const; uint max_supported_key_part_length() const { return 3500; } const key_map *keys_to_use_for_scanning() { return &key_map_full; } bool has_transactions() { return 1;} Loading
storage/innobase/btr/btr0sea.c +18 −10 Original line number Diff line number Diff line Loading @@ -904,7 +904,6 @@ btr_search_drop_page_hash_index( ulint* folds; ulint i; mem_heap_t* heap; dict_index_t* index; ulint* offsets; #ifdef UNIV_SYNC_DEBUG Loading Loading @@ -933,16 +932,11 @@ btr_search_drop_page_hash_index( n_fields = block->curr_n_fields; n_bytes = block->curr_n_bytes; index = block->index; /* NOTE: The fields of block must not be accessed after releasing btr_search_latch, as the index page might only be s-latched! */ ut_a(n_fields + n_bytes > 0); rw_lock_s_unlock(&btr_search_latch); ut_a(n_fields + n_bytes > 0); n_recs = page_get_n_recs(page); /* Calculate and cache fold values into an array for fast deletion Loading @@ -955,6 +949,14 @@ btr_search_drop_page_hash_index( rec = page_get_infimum_rec(page); rec = page_rec_get_next(rec); if (!page_rec_is_supremum(rec)) { ut_a(n_fields <= rec_get_n_fields(rec, block->index)); if (n_bytes > 0) { ut_a(n_fields < rec_get_n_fields(rec, block->index)); } } tree_id = btr_page_get_index_id(page); prev_fold = 0; Loading @@ -962,12 +964,18 @@ btr_search_drop_page_hash_index( heap = NULL; offsets = NULL; if (block->index == NULL) { mem_analyze_corruption((byte*)block); ut_a(block->index != NULL); } while (!page_rec_is_supremum(rec)) { /* FIXME: in a mixed tree, not all records may have enough ordering fields: */ offsets = rec_get_offsets(rec, index, offsets, n_fields + (n_bytes > 0), &heap); ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0)); offsets = rec_get_offsets(rec, block->index, offsets, n_fields + (n_bytes > 0), &heap); fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id); if (fold == prev_fold && prev_fold != 0) { Loading