diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index e5a5e121d74..3350bfa17a7 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -557,8 +557,11 @@ static int process_all_tables_in_db(char *database) else { while ((row = mysql_fetch_row(res))) - /* Skip tables with an engine of NULL (probably a view). */ - if (row[1]) + /* + Skip tables with an engine of NULL (probably a view) + if we don't perform renaming. + */ + if (row[1] || what_to_do == DO_UPGRADE) { handle_request_for_tables(row[0], fixed_name_length(row[0])); } diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 54b513bd1b1..047b2662b1b 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -63,3 +63,21 @@ test.t 1 OK test.t`1 OK drop table `t``1`, `t 1`; End of 5.0 tests +create table t1(a int); +create view v1 as select * from t1; +show tables; +Tables_in_test +t1 +v1 +show tables; +Tables_in_test +t1 +#mysql50#v-1 +v1 +show tables; +Tables_in_test +t1 +v1 +v-1 +drop view v1, `v-1`; +drop table t1; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index b9e022bf29a..6a7f44b4dbe 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -47,3 +47,16 @@ create table `t 1`(a int); drop table `t``1`, `t 1`; --echo End of 5.0 tests + +# +# Bug #30679: 5.1 name encoding not performed for views during upgrade +# +create table t1(a int); +create view v1 as select * from t1; +show tables; +--copy_file $MYSQLTEST_VARDIR/master-data/test/v1.frm $MYSQLTEST_VARDIR/master-data/test/v-1.frm +show tables; +--exec $MYSQL_CHECK --check-upgrade --fix-table-names --databases test +show tables; +drop view v1, `v-1`; +drop table t1;