summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-06-01 16:01:23 +0200
committerSergei Golubchik <serg@mariadb.org>2015-06-01 16:01:23 +0200
commitfce4ab0ab405e112035bda98176c5834200d26df (patch)
tree97ccac45b59d1523c22408427f701353284d66ec /sql
parent5091a4ba755250ed8e35f4f5a39a118d476cd8f1 (diff)
downloadmariadb-git-fce4ab0ab405e112035bda98176c5834200d26df.tar.gz
generalize ER_TABLE_NEEDS_UPGRADE to work for views too
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc5
-rw-r--r--sql/share/errmsg-utf8.txt4
-rw-r--r--sql/sql_admin.cc6
3 files changed, 9 insertions, 6 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 3ca9ec335cd..8d69a93c2c1 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -359,7 +359,7 @@ int ha_init_errors(void)
SETMSG(HA_ERR_NO_CONNECTION, "Could not connect to storage engine");
SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER_DEFAULT(ER_TABLE_DEF_CHANGED));
SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY, "FK constraint would lead to duplicate key");
- SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER_DEFAULT(ER_TABLE_NEEDS_UPGRADE));
+ SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, "Table upgrade required. Please do \"REPAIR TABLE %`\" or dump/reload to fix it");
SETMSG(HA_ERR_TABLE_READONLY, ER_DEFAULT(ER_OPEN_AS_READONLY));
SETMSG(HA_ERR_AUTOINC_READ_FAILED, ER_DEFAULT(ER_AUTOINC_READ_FAILED));
SETMSG(HA_ERR_AUTOINC_ERANGE, ER_DEFAULT(ER_WARN_DATA_OUT_OF_RANGE));
@@ -3537,7 +3537,8 @@ void handler::print_error(int error, myf errflag)
DBUG_VOID_RETURN;
}
case HA_ERR_TABLE_NEEDS_UPGRADE:
- textno=ER_TABLE_NEEDS_UPGRADE;
+ my_error(ER_TABLE_NEEDS_UPGRADE, errflag,
+ "TABLE", table_share->table_name.str);
break;
case HA_ERR_NO_PARTITION_FOUND:
textno=ER_WRONG_PARTITION_NAME;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 6627d33287d..084674065e4 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -5571,8 +5571,8 @@ ER_SP_WRONG_NAME 42000
eng "Incorrect routine name '%-.192s'"
ger "Ungültiger Routinenname '%-.192s'"
ER_TABLE_NEEDS_UPGRADE
- eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" or dump/reload to fix it!"
- ger "Tabellenaktualisierung erforderlich. Bitte zum Reparieren \"REPAIR TABLE `%-.32s`\" eingeben!"
+ eng "Upgrade required. Please do \"REPAIR %s %`s\" or dump/reload to fix it!"
+ ger "Aktualisierung erforderlich. Bitte zum Reparieren \"REPAIR %s %`s\" eingeben!"
ER_SP_NO_AGGREGATE 42000
eng "AGGREGATE is not supported for stored functions"
ger "AGGREGATE wird bei gespeicherten Funktionen nicht unterstützt"
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index cbcdf083291..5b64a792016 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -978,11 +978,13 @@ send_result_message:
{
char buf[MYSQL_ERRMSG_SIZE];
size_t length;
+ const char *what_to_upgrade= table->view ? "VIEW" :
+ table->table->file->ha_table_flags() & HA_CAN_REPAIR ? "TABLE" : 0;
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- if (table->table->file->ha_table_flags() & HA_CAN_REPAIR)
+ if (what_to_upgrade)
length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
- table->table_name);
+ what_to_upgrade, table->table_name);
else
length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_REBUILD),
table->table_name);