From 475eac91ce320321a499e546f5c9e308c680a5e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Jul 2007 14:43:56 -0400 Subject: [PATCH 1/7] Bug #29784 YaSSL assertion failure when reading 8k key. Fixed the yassl base64 decoding to correctly allocate a maximum decoded buffer size. mysql-test/std_data/server8k-cert.pem: BitKeeper file /Users/dkatz/50/mysql-test/std_data/server8k-cert.pem mysql-test/std_data/server8k-key.pem: BitKeeper file /Users/dkatz/50/mysql-test/std_data/server8k-key.pem extra/yassl/taocrypt/src/coding.cpp: Fixed buffer allocation to compute the proper maximum decoded size: (EncodedLength * 3/4) + 3 mysql-test/r/ssl_8k_key.result: New BitKeeper file ``mysql-test/r/ssl_8k_key.result'' Test connection to server using large SSL key. mysql-test/t/ssl_8k_key.test: New BitKeeper file ``mysql-test/t/ssl_8k_key.test'' Test connection to server using large SSL key. --- extra/yassl/taocrypt/src/coding.cpp | 2 +- mysql-test/r/ssl_8k_key.result | 2 + mysql-test/std_data/server8k-cert.pem | 51 ++++++++++++++ mysql-test/std_data/server8k-key.pem | 99 +++++++++++++++++++++++++++ mysql-test/t/ssl_8k_key.test | 6 ++ 5 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/ssl_8k_key.result create mode 100644 mysql-test/std_data/server8k-cert.pem create mode 100644 mysql-test/std_data/server8k-key.pem create mode 100644 mysql-test/t/ssl_8k_key.test diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp index 68055b3aff4..55fe31831e3 100644 --- a/extra/yassl/taocrypt/src/coding.cpp +++ b/extra/yassl/taocrypt/src/coding.cpp @@ -184,7 +184,7 @@ void Base64Decoder::Decode() { word32 bytes = coded_.size(); word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); - plainSz = (plainSz * 3 + 3) / 4; + plainSz = ((plainSz * 3) / 4) + 3; decoded_.New(plainSz); word32 i = 0; diff --git a/mysql-test/r/ssl_8k_key.result b/mysql-test/r/ssl_8k_key.result new file mode 100644 index 00000000000..b33a1d2854f --- /dev/null +++ b/mysql-test/r/ssl_8k_key.result @@ -0,0 +1,2 @@ +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA diff --git a/mysql-test/std_data/server8k-cert.pem b/mysql-test/std_data/server8k-cert.pem new file mode 100644 index 00000000000..a0750f9e69e --- /dev/null +++ b/mysql-test/std_data/server8k-cert.pem @@ -0,0 +1,51 @@ +-----BEGIN CERTIFICATE----- +MIIJHDCCBQQCAQEwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCU0UxEDAOBgNV +BAgTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMQ0wCwYDVQQLEwRUZXN0MQsw +CQYDVQQDEwJDQTAeFw0wNzA3MTMwNzU2MjVaFw0xMDA0MDgwNzU2MjVaMFoxCzAJ +BgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRkwFwYDVQQKFBBNeVNRTCAgIAog +ICAgIEFCMQ0wCwYDVQQLEwRUZXN0MQ8wDQYDVQQDEwZzZXJ2ZXIwggQiMA0GCSqG +SIb3DQEBAQUAA4IEDwAwggQKAoIEAQDUFlh/3mwov5YaICFXOdJXgHV/uDkTjXB6 +9oxlipshQaYPX8LDT5vhI3gPciS1Z1sRE2dTcC4Mk2K4LDUIjp3WkeTfFAHZPV3E +Y+3OH/ftH4N6SEIBTKE4EY6ah0nJtU98M0JhxOh5zHje6zQp1SkBnhEOQYexYRqj +OtGloZ9RyF0iFAXcyu2Ap14u37l5Yla0cyPzvZqP4mFYlcXwaRfAacJmqMM1vuQv +Fx1JITUTBugMF3VGZ1F0tw63EIUH/FW/WWncPqvG18na40qlv9ZkBw0FhZeKS8cK +JIY5y4J30jn/eV8p1lTO7K+ASTuGZWmdRDgjUG0Y9OGuKsPPoaE6ml0HTnMBsBSQ +fXUq9XkwGt8DTgPioAKHBHjLbILEy4FMYWrlTZlPTzNqyhayec/2T15oDladNSt7 +JpDLpX70UECXFhd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CF8niQIl3MrBAL +sKPLft1drmpqdIQpZQIJxtN/AQuD9mxEdW7XA6rkvFySKcswJpS1QjkSWpafCBWE +wu+SPxZL8oFrnNMTU3JloUjcRp70FkNXLLm/Dy+MjW2qFBtIoBgNptVGp94L1uZS +amd2XJMcOQ+X9fcH3wAdM3IHGn3NiLf6eTW92JNNA0IN6aNtyVaJKmFJ1JfXOl9r +ujr4SorRSesaerjIcuzW1u1YE5RlgeI4kizV2/D5kYc= +-----END CERTIFICATE----- diff --git a/mysql-test/std_data/server8k-key.pem b/mysql-test/std_data/server8k-key.pem new file mode 100644 index 00000000000..608593a5096 --- /dev/null +++ b/mysql-test/std_data/server8k-key.pem @@ -0,0 +1,99 @@ +-----BEGIN RSA PRIVATE KEY----- +MIISKQIBAAKCBAEA1BZYf95sKL+WGiAhVznSV4B1f7g5E41wevaMZYqbIUGmD1/C +w0+b4SN4D3IktWdbERNnU3AuDJNiuCw1CI6d1pHk3xQB2T1dxGPtzh/37R+DekhC +AUyhOBGOmodJybVPfDNCYcToecx43us0KdUpAZ4RDkGHsWEaozrRpaGfUchdIhQF +3MrtgKdeLt+5eWJWtHMj872aj+JhWJXF8GkXwGnCZqjDNb7kLxcdSSE1EwboDBd1 +RmdRdLcOtxCFB/xVv1lp3D6rxtfJ2uNKpb/WZAcNBYWXikvHCiSGOcuCd9I5/3lf +KdZUzuyvgEk7hmVpnUQ4I1BtGPThrirDz6GhOppdB05zAbAUkH11KvV5MBrfA04D +4qAChwR4y2yCxMuBTGFq5U2ZT08zasoWsnnP9k9eaA5WnTUreyaQy6V+9FBAlxYX +RBsbBsbV3SmyAbzZtsk+F9p8VvSLbBAo0koA/veE4BqGvECg8K6ZoKvlqqZueAmd +bzdaKsjFMNbIzRF/4iwchwI0gC28tin35OXJeZp7Eenf5OI7InN0LHIsJHfq0Lf/ +FTIUtp7N55Hs/wStxb0ANjLPMSYRS37M1awYZ43BUUzU9vvyjJa9aE+UNV2Si+6l +V06Wmzy+dSZVQS+Qkh5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6C5I7 +v2sKhLK5gu3uPBB2ludDEXSpWBqiraynolOT/o52r+taYp9YY2WU3GrhOiV/A1FV +Nl118xiF6FOFpEeTbhHvy27A8kZEKXgeSs+f4aC0XG9kLVD1CiCbQiqHTDcDS4nV +O1N1eQxhP81X+YKE4Lgufh07REqYVwtCj2lQcMp73WDyfBLKTEFlmHusoqmT5JCH +X0BWNjk5Dn1g5h63/lQb+EjNRILBhDFYhrDRDQtw5p0/7IY3AcNKDUHv+XGn +-----END RSA PRIVATE KEY----- diff --git a/mysql-test/t/ssl_8k_key.test b/mysql-test/t/ssl_8k_key.test new file mode 100644 index 00000000000..b4203e68445 --- /dev/null +++ b/mysql-test/t/ssl_8k_key.test @@ -0,0 +1,6 @@ +-- source include/have_ssl.inc +# +# Bug#29784 YaSSL assertion failure when reading 8k key. +# +--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1 + From 6947f2d1316c7b0b7ede841a097328da8c21aa4d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jul 2007 12:13:45 +0500 Subject: [PATCH 2/7] Fix for bug #28125: ERROR 2013 when adding index. Problem: we may break a multibyte char sequence using a key reduced to maximum allowed length for a storage engine (that leads to failed assertion in the innodb code, see also #17530). Fix: align truncated key length to multibyte char boundary. mysql-test/r/innodb_mysql.result: Fix for bug #28125: ERROR 2013 when adding index. - test result. mysql-test/t/innodb_mysql.test: Fix for bug #28125: ERROR 2013 when adding index. - test case. sql/sql_table.cc: Fix for bug #28125: ERROR 2013 when adding index. - align truncated key length to multibyte char boundary. - display real key length in bytes raising warnings. --- mysql-test/r/innodb_mysql.result | 14 +++++++++++++- mysql-test/t/innodb_mysql.test | 9 +++++++++ sql/sql_table.cc | 6 ++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 4535710c905..4c1e7189998 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -418,7 +418,7 @@ DROP TABLE t1,t2; create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb character set utf8 collate utf8_general_ci; Warnings: -Warning 1071 Specified key was too long; max key length is 765 bytes +Warning 1071 Specified key was too long; max key length is 767 bytes insert into t1 values('aaa'); drop table t1; CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB; @@ -735,4 +735,16 @@ COUNT(*) 3072 set @@sort_buffer_size=default; DROP TABLE t1,t2; +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +alter table t1 add index(a(1024)); +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` ( + `a` text, + KEY `a` (`a`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +drop table t1; End of 5.0 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index d4ce997ddb1..4930ec81a62 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -741,4 +741,13 @@ set @@sort_buffer_size=default; DROP TABLE t1,t2; +# +# Bug #28125: ERROR 2013 when adding index. +# +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +alter table t1 add index(a(1024)); +show create table t1; +drop table t1; + --echo End of 5.0 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 87f23097a66..0da639f9896 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1357,6 +1357,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, length); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TOO_LONG_KEY, warn_buff); + /* Align key length to multibyte char boundary */ + length-= length % sql_field->charset->mbmaxlen; } else { @@ -1387,8 +1389,6 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, if (length > file->max_key_part_length() && key->type != Key::FULLTEXT) { length= file->max_key_part_length(); - /* Align key length to multibyte char boundary */ - length-= length % sql_field->charset->mbmaxlen; if (key->type == Key::MULTIPLE) { /* not a critical problem */ @@ -1397,6 +1397,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, length); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TOO_LONG_KEY, warn_buff); + /* Align key length to multibyte char boundary */ + length-= length % sql_field->charset->mbmaxlen; } else { From 8b8b430bbccc01717e3eb50e4e452cf415292d00 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jul 2007 14:03:58 -0400 Subject: [PATCH 3/7] Bug#26909: Specified key was too long; max key length is 255 bytes \ when creating table Federated tables had an artificially low maximum of key length, because the handler failed to implement a method to return it and the default value is taked from the prototype handler. Now, implement that method and return the maximum possible key length, which is that of InnoDB. mysql-test/r/federated.result: Verify that unique keys may be longer than 255 characters. mysql-test/t/federated.test: Verify that unique keys may be longer than 255 characters. sql/ha_federated.h: Implement the virtual method that tells the max size of parts to make a key. Backport the length defined in 5.1. --- mysql-test/r/federated.result | 37 ++++++++++++++++++++++++++++++++ mysql-test/t/federated.test | 40 +++++++++++++++++++++++++++++++++++ sql/ha_federated.h | 4 +++- 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index cecffbb1471..b69ff8033d4 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1843,6 +1843,43 @@ C3A4C3B6C3BCC39F D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E drop table federated.t1; drop table federated.t1; +CREATE TABLE federated.t1 ( +categoryId int(11) NOT NULL AUTO_INCREMENT, +domainId varchar(745) NOT NULL DEFAULT '', +categoryName varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (categoryId), +UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), +KEY idx_category_domainId (domainId) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TABLE federated.t1 ( +categoryId int(11) NOT NULL AUTO_INCREMENT, +domainId varchar(745) NOT NULL DEFAULT '', +categoryName varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (categoryId), +UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), +KEY idx_category_domainId (domainId) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); +insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); +insert into federated.t1 (domainId, categoryName) values ('a', 'b'); +select categoryId from federated.t1 order by domainId, categoryName; +categoryId +1 +2 +3 +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +categoryId +3 +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +categoryId +3 +select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; +categoryId +1 +2 +drop table federated.t1; +drop table federated.t1; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 894cd513914..e3c7d478c78 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1575,5 +1575,45 @@ drop table federated.t1; connection slave; drop table federated.t1; +# +# Bug#26909: Specified key was too long; max key length is 255 bytes +# when creating a table +# +connection slave; +CREATE TABLE federated.t1 ( + categoryId int(11) NOT NULL AUTO_INCREMENT, + domainId varchar(745) NOT NULL DEFAULT '', + categoryName varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (categoryId), + UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), + KEY idx_category_domainId (domainId) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + categoryId int(11) NOT NULL AUTO_INCREMENT, + domainId varchar(745) NOT NULL DEFAULT '', + categoryName varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (categoryId), + UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), + KEY idx_category_domainId (domainId) + ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + + +insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); +insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); +insert into federated.t1 (domainId, categoryName) values ('a', 'b'); + +select categoryId from federated.t1 order by domainId, categoryName; +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; + +drop table federated.t1; + +connection slave; +drop table federated.t1; source include/federated_cleanup.inc; diff --git a/sql/ha_federated.h b/sql/ha_federated.h index 09c934cb493..9f24e92357c 100644 --- a/sql/ha_federated.h +++ b/sql/ha_federated.h @@ -37,6 +37,7 @@ #define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5 #define FEDERATED_RECORDS_IN_RANGE 2 +#define FEDERATED_MAX_KEY_LENGTH 3500 // Same as innodb #define FEDERATED_INFO " SHOW TABLE STATUS LIKE " #define FEDERATED_INFO_LEN sizeof(FEDERATED_INFO) #define FEDERATED_SELECT "SELECT " @@ -217,7 +218,8 @@ public: uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } uint max_supported_keys() const { return MAX_KEY; } uint max_supported_key_parts() const { return MAX_REF_PARTS; } - uint max_supported_key_length() const { return MAX_KEY_LENGTH; } + uint max_supported_key_length() const { return FEDERATED_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const { return FEDERATED_MAX_KEY_LENGTH; } /* Called in test_quick_select to determine if indexes should be used. Normally, we need to know number of blocks . For federated we need to From 4740e005a0bff2f89b484634adfcd25f34ba15d9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Jul 2007 15:25:54 -0400 Subject: [PATCH 4/7] Bug #29910 Sporadic test failure in status.test mysql-test/t/status.test: Fixed test to correctly wait for right server process and state. --- mysql-test/t/status.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index 1208393aa09..9fd54d4766d 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -22,13 +22,13 @@ connection con2; lock tables t1 read; unlock tables; lock tables t1 read; -let $ID= `select connection_id()`; connection con1; +let $ID= `select connection_id()`; --send update t1 set n = 3; connection con2; # wait for the other query to start executing -let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = 0; +let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = "Locked"; --source include/wait_condition.inc unlock tables; connection con1; From 28ec0efcb6810c98af5bfbeeaaf0bfa13343a874 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 11:23:38 +0500 Subject: [PATCH 5/7] Fixed #29923: federated.test fails in 5.0-maint, 5.1-maint Result adjusted. mysql-test/r/federated.result: Fixed #29923: federated.test fails in 5.0-maint, 5.1-maint - result adjusted. --- mysql-test/r/federated.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 076e165b21e..56522ba2f50 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1878,6 +1878,8 @@ select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' or categoryId 1 2 +drop table federated.t1; +drop table federated.t1; create table federated.t1 (a int primary key, b varchar(64)) DEFAULT CHARSET=utf8; create table federated.t1 (a int primary key, b varchar(64)) From 30b0de253ca1509e1c14c85ea74d82ae33acaa9c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 11:45:08 +0500 Subject: [PATCH 6/7] after-merge fixup. --- mysql-test/r/federated.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 966816ee19b..5c5cb7eaa79 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1878,6 +1878,8 @@ select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' or categoryId 1 2 +drop table federated.t1; +drop table federated.t1; create table federated.t1 (a int primary key, b varchar(64)) DEFAULT CHARSET=utf8; create table federated.t1 (a int primary key, b varchar(64)) From 866225919c303f36e83b6af10e3908bcb39bda62 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 15:19:37 +0500 Subject: [PATCH 7/7] after-merge fixup --- mysql-test/r/innodb_mysql.result | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 9494a04f593..6bc3084cf6d 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -755,7 +755,7 @@ drop table t1,t2; create table t1(f1 varchar(800) binary not null, key(f1)) character set utf8 collate utf8_general_ci; Warnings: -Warning 1071 Specified key was too long; max key length is 765 bytes +Warning 1071 Specified key was too long; max key length is 767 bytes insert into t1 values('aaa'); drop table t1; CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB; @@ -814,6 +814,19 @@ drop table if exists t1; create table t1 (a int) engine=innodb; alter table t1 alter a set default 1; drop table t1; +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +alter table t1 add index(a(1024)); +Warnings: +Warning 1071 Specified key was too long; max key length is 767 bytes +Warning 1071 Specified key was too long; max key length is 767 bytes +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text, + KEY `a` (`a`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +drop table t1; End of 5.0 tests CREATE TABLE `t2` ( `k` int(11) NOT NULL auto_increment,