diff --git a/include/my_base.h b/include/my_base.h index 1713a07f6ec..25fa683744e 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -312,7 +312,9 @@ enum ha_base_keytype { #define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */ #define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ #define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */ -#define HA_ERR_LAST 158 /*Copy last error nr.*/ +#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */ + +#define HA_ERR_LAST 159 /*Copy last error nr.*/ /* Add error numbers before HA_ERR_LAST and change it accordingly. */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test index 6f0e51b7a4d..18c7ff47b18 100644 --- a/mysql-test/t/ndb_alter_table.test +++ b/mysql-test/t/ndb_alter_table.test @@ -147,7 +147,7 @@ select * from t1 where b = 'two'; connection server1; alter table t1 drop index c; connection server2; ---error 1105 +--error 1412 select * from t1 where b = 'two'; select * from t1 where b = 'two'; connection server1; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 5848fc002e4..a60f8133d47 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -192,6 +192,8 @@ static const err_code_mapping err_map[]= { 827, HA_ERR_RECORD_FILE_FULL, 1 }, { 832, HA_ERR_RECORD_FILE_FULL, 1 }, + { 284, HA_ERR_TABLE_DEF_CHANGED, 0 }, + { 0, 1, 0 }, { -1, -1, 1 } @@ -470,16 +472,7 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans) if (err.code != 709) DBUG_RETURN(1); } - else - { - DBUG_PRINT("info", ("Table exist but must have changed")); - /* In 5.0, this should be replaced with a mapping to a mysql error */ - my_printf_error(ER_UNKNOWN_ERROR, - "Table definition has changed, "\ - "please retry transaction", - MYF(0)); - DBUG_RETURN(1); - } + DBUG_PRINT("info", ("Table exists but must have changed")); } break; default: diff --git a/sql/handler.cc b/sql/handler.cc index 7cd2fd303f0..f20ee0c4d77 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -304,6 +304,7 @@ static int ha_init_errors(void) SETMSG(HA_ERR_NO_SUCH_TABLE, "No such table: '%.64s'"); SETMSG(HA_ERR_TABLE_EXIST, ER(ER_TABLE_EXISTS_ERROR)); SETMSG(HA_ERR_NO_CONNECTION, "Could not connect to storage engine"); + SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER(ER_TABLE_DEF_CHANGED)); /* Register the error messages for use with my_error(). */ return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST); @@ -1646,6 +1647,9 @@ void handler::print_error(int error, myf errflag) case HA_ERR_NO_REFERENCED_ROW: textno=ER_NO_REFERENCED_ROW; break; + case HA_ERR_TABLE_DEF_CHANGED: + textno=ER_TABLE_DEF_CHANGED; + break; case HA_ERR_NO_SUCH_TABLE: { /* diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 9a92f1f4f76..047c30f6cd0 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5336,3 +5336,6 @@ ER_CANT_CREATE_USER_WITH_GRANT 42000 eng "You are not allowed to create a user with GRANT" ER_WRONG_VALUE_FOR_TYPE eng "Incorrect %-.32s value: '%-.128s' for function %-.32s" +ER_TABLE_DEF_CHANGED + eng "Table definition has changed, please retry transaction" +