Bug #16502: mysqlcheck gets confused with views
Make mysqlcheck skip over views when processing all of the tables in a database.
This commit is contained in:
parent
b7a55b9b5c
commit
8489a8db07
@ -458,7 +458,7 @@ static int process_all_tables_in_db(char *database)
|
|||||||
LINT_INIT(res);
|
LINT_INIT(res);
|
||||||
if (use_db(database))
|
if (use_db(database))
|
||||||
return 1;
|
return 1;
|
||||||
if (mysql_query(sock, "SHOW TABLES") ||
|
if (mysql_query(sock, "SHOW TABLE STATUS") ||
|
||||||
!((res= mysql_store_result(sock))))
|
!((res= mysql_store_result(sock))))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -483,10 +483,14 @@ static int process_all_tables_in_db(char *database)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (end = tables + 1; (row = mysql_fetch_row(res)) ;)
|
for (end = tables + 1; (row = mysql_fetch_row(res)) ;)
|
||||||
|
{
|
||||||
|
/* Skip tables with an engine of NULL (probably a view). */
|
||||||
|
if (row[1])
|
||||||
{
|
{
|
||||||
end= fix_table_name(end, row[0]);
|
end= fix_table_name(end, row[0]);
|
||||||
*end++= ',';
|
*end++= ',';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*--end = 0;
|
*--end = 0;
|
||||||
if (tot_length)
|
if (tot_length)
|
||||||
handle_request_for_tables(tables + 1, tot_length - 1);
|
handle_request_for_tables(tables + 1, tot_length - 1);
|
||||||
@ -495,8 +499,12 @@ static int process_all_tables_in_db(char *database)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
while ((row = mysql_fetch_row(res)))
|
while ((row = mysql_fetch_row(res)))
|
||||||
|
/* Skip tables with an engine of NULL (probably a view). */
|
||||||
|
if (row[1])
|
||||||
|
{
|
||||||
handle_request_for_tables(row[0], strlen(row[0]));
|
handle_request_for_tables(row[0], strlen(row[0]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
return 0;
|
return 0;
|
||||||
} /* process_all_tables_in_db */
|
} /* process_all_tables_in_db */
|
||||||
|
@ -32,3 +32,10 @@ mysql.time_zone_name OK
|
|||||||
mysql.time_zone_transition OK
|
mysql.time_zone_transition OK
|
||||||
mysql.time_zone_transition_type OK
|
mysql.time_zone_transition_type OK
|
||||||
mysql.user OK
|
mysql.user OK
|
||||||
|
create table t1 (a int);
|
||||||
|
create view v1 as select * from t1;
|
||||||
|
test.t1 OK
|
||||||
|
test.t1 OK
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
End of 5.0 tests
|
||||||
|
@ -9,3 +9,17 @@
|
|||||||
--replace_result 'Table is already up to date' OK
|
--replace_result 'Table is already up to date' OK
|
||||||
--exec $MYSQL_CHECK --analyze --optimize --databases test information_schema mysql
|
--exec $MYSQL_CHECK --analyze --optimize --databases test information_schema mysql
|
||||||
--exec $MYSQL_CHECK --analyze --optimize information_schema schemata
|
--exec $MYSQL_CHECK --analyze --optimize information_schema schemata
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #16502: mysqlcheck tries to check views
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
create view v1 as select * from t1;
|
||||||
|
--replace_result 'Table is already up to date' OK
|
||||||
|
--exec $MYSQL_CHECK --analyze --optimize --databases test
|
||||||
|
--replace_result 'Table is already up to date' OK
|
||||||
|
--exec $MYSQL_CHECK --all-in-1 --analyze --optimize --databases test
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo End of 5.0 tests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user