Commit fce4ab0a authored by Sergei Golubchik's avatar Sergei Golubchik

generalize ER_TABLE_NEEDS_UPGRADE to work for views too

parent 5091a4ba
......@@ -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;
......
......@@ -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
......
......@@ -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)
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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"
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment