From 685f665b067d44addc5034c8ea7c09e1d6e35cb0 Mon Sep 17 00:00:00 2001 From: marko <> Date: Mon, 17 Sep 2007 10:43:51 +0000 Subject: [PATCH] branches/zip: ha_innobase::add_index(): Translate DB_TOO_BIG_RECORD via my_error(). Add a test case to innodb-index.test. --- handler/handler0alter.cc | 4 ++++ mysql-test/innodb-index.result | 2 ++ mysql-test/innodb-index.test | 2 ++ 3 files changed, 8 insertions(+) diff --git a/handler/handler0alter.cc b/handler/handler0alter.cc index d31e9ed6e5b..7b87b9f8a58 100644 --- a/handler/handler0alter.cc +++ b/handler/handler0alter.cc @@ -720,10 +720,14 @@ error_handling: error = row_merge_drop_table(trx, innodb_table); goto convert_error; + case DB_TOO_BIG_RECORD: + my_error(HA_ERR_TO_BIG_ROW, MYF(0)); + goto error; case DB_PRIMARY_KEY_IS_NULL: my_error(ER_PRIMARY_CANT_HAVE_NULL, MYF(0)); /* fall through */ case DB_DUPLICATE_KEY: +error: prebuilt->trx->error_info = NULL; prebuilt->trx->error_key_num = trx->error_key_num; /* fall through */ diff --git a/mysql-test/innodb-index.result b/mysql-test/innodb-index.result index 1c96c8f19e2..4e859db3096 100644 --- a/mysql-test/innodb-index.result +++ b/mysql-test/innodb-index.result @@ -1031,6 +1031,8 @@ NULL NULL NULL null alter table t1 add primary key (a), add key (b(20)); ERROR 42000: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead delete from t1 where d='null'; +alter table t1 add primary key (a,b(255),c(255)), add key (b(255)); +ERROR HY000: Too big row alter table t1 add primary key (a), add key (b(20)); select count(*) from t1 where a=44; count(*) diff --git a/mysql-test/innodb-index.test b/mysql-test/innodb-index.test index e308e1b2f1f..eb76b9a5c3a 100644 --- a/mysql-test/innodb-index.test +++ b/mysql-test/innodb-index.test @@ -317,6 +317,8 @@ select a,length(b),length(c),d from t1; --error ER_PRIMARY_CANT_HAVE_NULL alter table t1 add primary key (a), add key (b(20)); delete from t1 where d='null'; +--error 139 +alter table t1 add primary key (a,b(255),c(255)), add key (b(255)); alter table t1 add primary key (a), add key (b(20)); select count(*) from t1 where a=44; select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;