Skip to content

Commit b4def7b

Browse files
committed
Bug #48985: show create table crashes if previous access to the table
was killed Merge the fix from 5.1-bugteam to 5.1-main
1 parent 7b7a5c6 commit b4def7b

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

mysql-test/r/show_check.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,4 +1454,10 @@ GRANT PROCESS ON *.* TO test_u@localhost;
14541454
SHOW ENGINE MYISAM MUTEX;
14551455
SHOW ENGINE MYISAM STATUS;
14561456
DROP USER test_u@localhost;
1457+
#
1458+
# Bug #48985: show create table crashes if previous access to the table
1459+
# was killed
1460+
#
1461+
SHOW CREATE TABLE non_existent;
1462+
ERROR 70100: Query execution was interrupted
14571463
End of 5.1 tests

mysql-test/t/show_check.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,28 @@ connection default;
12071207
DROP USER test_u@localhost;
12081208

12091209

1210+
--echo #
1211+
--echo # Bug #48985: show create table crashes if previous access to the table
1212+
--echo # was killed
1213+
--echo #
1214+
1215+
connect(con1,localhost,root,,);
1216+
CONNECTION con1;
1217+
LET $ID= `SELECT connection_id()`;
1218+
1219+
CONNECTION default;
1220+
--disable_query_log
1221+
eval KILL QUERY $ID;
1222+
--enable_query_log
1223+
1224+
CONNECTION con1;
1225+
--error ER_QUERY_INTERRUPTED
1226+
SHOW CREATE TABLE non_existent;
1227+
1228+
CONNECTION default;
1229+
DISCONNECT con1;
1230+
1231+
12101232
--echo End of 5.1 tests
12111233

12121234
# Wait till all disconnects are completed

sql/sql_show.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
719719
thd->push_internal_handler(&view_error_suppressor);
720720
bool error= open_normal_and_derived_tables(thd, table_list, 0);
721721
thd->pop_internal_handler();
722-
if (error && thd->main_da.is_error())
722+
if (error && (thd->killed || thd->main_da.is_error()))
723723
DBUG_RETURN(TRUE);
724724
}
725725

0 commit comments

Comments
 (0)