summaryrefslogtreecommitdiff
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
parent5091a4ba755250ed8e35f4f5a39a118d476cd8f1 (diff)
downloadmariadb-git-fce4ab0ab405e112035bda98176c5834200d26df.tar.gz
generalize ER_TABLE_NEEDS_UPGRADE to work for views too
-rw-r--r--mysql-test/r/ctype_upgrade.result10
-rw-r--r--mysql-test/r/mysqlcheck.result2
-rw-r--r--mysql-test/r/perror.result2
-rw-r--r--mysql-test/r/repair.result2
-rw-r--r--mysql-test/r/upgrade.result2
-rw-r--r--mysql-test/r/varbinary.result2
-rw-r--r--mysql-test/suite/archive/archive.result2
-rw-r--r--sql/handler.cc5
-rw-r--r--sql/share/errmsg-utf8.txt4
-rw-r--r--sql/sql_admin.cc6
10 files changed, 20 insertions, 17 deletions
diff --git a/mysql-test/r/ctype_upgrade.result b/mysql-test/r/ctype_upgrade.result
index 6bef89f6cd6..b317be42d5c 100644
--- a/mysql-test/r/ctype_upgrade.result
+++ b/mysql-test/r/ctype_upgrade.result
@@ -6,7 +6,7 @@ call mtr.add_suppression("Table rebuild required");
# Copying maria050313_utf8_croatian_ci.* to MYSQLD_DATADIR
CHECK TABLE maria050313_utf8_croatian_ci FOR UPGRADE;
Table Op Msg_type Msg_text
-test.maria050313_utf8_croatian_ci check error Table upgrade required. Please do "REPAIR TABLE `maria050313_utf8_croatian_ci`" or dump/reload to fix it!
+test.maria050313_utf8_croatian_ci check error Upgrade required. Please do "REPAIR TABLE `maria050313_utf8_croatian_ci`" or dump/reload to fix it!
SHOW CREATE TABLE maria050313_utf8_croatian_ci;
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria050313_utf8_croatian_c` FORCE" or dump/reload to fix it!
REPAIR TABLE maria050313_utf8_croatian_ci;
@@ -43,7 +43,7 @@ DROP TABLE maria050313_utf8_croatian_ci;
# Copying maria050313_ucs2_croatian_ci.* to MYSQLD_DATADIR
CHECK TABLE maria050313_ucs2_croatian_ci_def FOR UPGRADE;
Table Op Msg_type Msg_text
-test.maria050313_ucs2_croatian_ci_def check error Table upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it!
+test.maria050313_ucs2_croatian_ci_def check error Upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it!
SELECT count(*) FROM maria050313_ucs2_croatian_ci_def;
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria050313_ucs2_croatian_c` FORCE" or dump/reload to fix it!
REPAIR TABLE maria050313_ucs2_croatian_ci_def;
@@ -58,7 +58,7 @@ DROP TABLE maria050313_ucs2_croatian_ci_def;
# Copying maria050313_ucs2_croatian_ci.* to MYSQLD_DATADIR
CHECK TABLE maria050313_ucs2_croatian_ci_def;
Table Op Msg_type Msg_text
-test.maria050313_ucs2_croatian_ci_def check error Table upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it!
+test.maria050313_ucs2_croatian_ci_def check error Upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it!
REPAIR TABLE maria050313_ucs2_croatian_ci_def;
Table Op Msg_type Msg_text
test.maria050313_ucs2_croatian_ci_def repair status OK
@@ -84,7 +84,7 @@ DROP TABLE maria050313_ucs2_croatian_ci_def;
# Copying maria050533_xxx_croatian_ci.* to MYSQLD_DATADIR
CHECK TABLE maria050533_xxx_croatian_ci FOR UPGRADE;
Table Op Msg_type Msg_text
-test.maria050533_xxx_croatian_ci check error Table upgrade required. Please do "REPAIR TABLE `maria050533_xxx_croatian_ci`" or dump/reload to fix it!
+test.maria050533_xxx_croatian_ci check error Upgrade required. Please do "REPAIR TABLE `maria050533_xxx_croatian_ci`" or dump/reload to fix it!
REPAIR TABLE maria050533_xxx_croatian_ci;
Table Op Msg_type Msg_text
test.maria050533_xxx_croatian_ci repair status OK
@@ -141,7 +141,7 @@ DROP TABLE maria050533_xxx_croatian_ci;
# Copying maria100004_xxx_croatian_ci.* to MYSQLD_DATADIR
CHECK TABLE maria100004_xxx_croatian_ci FOR UPGRADE;
Table Op Msg_type Msg_text
-test.maria100004_xxx_croatian_ci check error Table upgrade required. Please do "REPAIR TABLE `maria100004_xxx_croatian_ci`" or dump/reload to fix it!
+test.maria100004_xxx_croatian_ci check error Upgrade required. Please do "REPAIR TABLE `maria100004_xxx_croatian_ci`" or dump/reload to fix it!
SELECT count(*) FROM maria100004_xxx_croatian_ci;
ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria100004_xxx_croatian_ci` FORCE" or dump/reload to fix it!
REPAIR TABLE maria100004_xxx_croatian_ci;
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 2d4a053b3a2..adfc56fcd69 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -329,7 +329,7 @@ DROP TABLE bug47205;
# Should indicate that REPAIR TABLE is needed
CHECK TABLE bug47205 FOR UPGRADE;
Table Op Msg_type Msg_text
-test.bug47205 check error Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it!
+test.bug47205 check error Upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it!
# Running mysqlcheck to check and upgrade
test.bug47205 Needs upgrade
diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result
index 30a56840b1b..432a4fd4c04 100644
--- a/mysql-test/r/perror.result
+++ b/mysql-test/r/perror.result
@@ -2,5 +2,5 @@ Illegal error code: 10000
MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
MySQL error code 1408 (ER_STARTUP): %s: ready for connections.
Version: '%s' socket: '%s' port: %d %s
-MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Table upgrade required. Please do "REPAIR TABLE `%-.32s`" or dump/reload to fix it!
+MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it!
MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %lu)
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index 79bc6d55c55..79ee0c7a9b8 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -126,7 +126,7 @@ id
# Run CHECK TABLE, it should indicate table need a REPAIR TABLE
CHECK TABLE t1 FOR UPGRADE;
Table Op Msg_type Msg_text
-test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
# REPAIR old table USE_FRM should fail
REPAIR TABLE t1 USE_FRM;
Table Op Msg_type Msg_text
diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result
index b6e924c71cc..74b888e49c5 100644
--- a/mysql-test/r/upgrade.result
+++ b/mysql-test/r/upgrade.result
@@ -67,7 +67,7 @@ drop table `txu@0023p@0023p1`;
# check the table created using mysql 4.0
CHECK TABLE t1;
Table Op Msg_type Msg_text
-test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
# query the table created using mysql 4.0
SELECT * FROM t1;
c1 c2 c3
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index 689db16b5d4..b5f6d065174 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -91,7 +91,7 @@ length(a) length(b)
255 3
CHECK TABLE t1 FOR UPGRADE;
Table Op Msg_type Msg_text
-test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
diff --git a/mysql-test/suite/archive/archive.result b/mysql-test/suite/archive/archive.result
index b92018fba8b..1cbaa0a31ea 100644
--- a/mysql-test/suite/archive/archive.result
+++ b/mysql-test/suite/archive/archive.result
@@ -12812,7 +12812,7 @@ a b c d e
2 text varchar blob1 blob2
CHECK TABLE t1;
Table Op Msg_type Msg_text
-test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
SELECT * FROM t1;
a b c d e
1 text varchar blob1 blob2
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);