From: Date: July 24 2006 10:31pm Subject: bk commit into 5.0 tree (jimw:1.2207) BUG#16502 List-Archive: http://lists.mysql.com/commits/9519 X-Bug: 16502 Message-Id: <20060724203123.B8B0BA82BC@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 5.0 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2006-07-24 13:31:20-07:00, jimw@rama.(none) +3 -0 Bug #16502: mysqlcheck gets confused with views Make mysqlcheck skip over views when processing all of the tables in a database. client/mysqlcheck.c@stripped, 2006-07-24 13:31:18-07:00, jimw@rama.(none) +12 -4 Use SHOW TABLE STATUS to get table list, and skip over things that don't have an engine (like a VIEW). mysql-test/r/mysqlcheck.result@stripped, 2006-07-24 13:31:18-07:00, jimw@rama.(none) +7 -0 Add new results mysql-test/t/mysqlcheck.test@stripped, 2006-07-24 13:31:18-07:00, jimw@rama.(none) +14 -0 Add new regression test # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-5.0-16502 --- 1.1/mysql-test/r/mysqlcheck.result 2006-07-24 13:31:23 -07:00 +++ 1.2/mysql-test/r/mysqlcheck.result 2006-07-24 13:31:23 -07:00 @@ -32,3 +32,10 @@ mysql.time_zone_name mysql.time_zone_transition OK mysql.time_zone_transition_type 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 --- 1.1/mysql-test/t/mysqlcheck.test 2006-07-24 13:31:23 -07:00 +++ 1.2/mysql-test/t/mysqlcheck.test 2006-07-24 13:31:23 -07:00 @@ -9,3 +9,17 @@ --replace_result 'Table is already up to date' OK --exec $MYSQL_CHECK --analyze --optimize --databases test information_schema mysql --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 --- 1.56/client/mysqlcheck.c 2006-07-24 13:31:23 -07:00 +++ 1.57/client/mysqlcheck.c 2006-07-24 13:31:23 -07:00 @@ -458,7 +458,7 @@ static int process_all_tables_in_db(char LINT_INIT(res); if (use_db(database)) return 1; - if (mysql_query(sock, "SHOW TABLES") || + if (mysql_query(sock, "SHOW TABLE STATUS") || !((res= mysql_store_result(sock)))) return 1; @@ -484,8 +484,12 @@ static int process_all_tables_in_db(char } for (end = tables + 1; (row = mysql_fetch_row(res)) ;) { - end= fix_table_name(end, row[0]); - *end++= ','; + /* Skip tables with an engine of NULL (probably a view). */ + if (row[1]) + { + end= fix_table_name(end, row[0]); + *end++= ','; + } } *--end = 0; if (tot_length) @@ -495,7 +499,11 @@ static int process_all_tables_in_db(char else { while ((row = mysql_fetch_row(res))) - handle_request_for_tables(row[0], strlen(row[0])); + /* Skip tables with an engine of NULL (probably a view). */ + if (row[1]) + { + handle_request_for_tables(row[0], strlen(row[0])); + } } mysql_free_result(res); return 0;