Commit 4236f589 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-14751 Server crashes in TABLE::versioned on 2nd execution of SP [fixes #431]

SQL: TABLE_LIST cleanup on free_tmp_table()

May affect non-versioning tests (main suite passed).
parent b9bc8bbd
......@@ -218,7 +218,20 @@ called bad
called bad
called bad
called bad
bad() is good.
# bad() is good.
# MDEV-14751 Server crashes in TABLE::versioned on 2nd execution of SP [#431]
create or replace table t1 (called_bad int);
create or replace table t2 (b int);
create or replace procedure bad() select * from t1 where ( 5, 6 ) in ( select b, b from t2 ) and called_bad in ( select max(b) from t2 );
called_bad
called_bad
called_bad
called_bad
called_bad
called_bad
called_bad
called_bad
# bad() is good.
# wildcard expansion on hidden fields.
create or replace table t1(
A int
......
......@@ -113,7 +113,17 @@ create or replace procedure bad() select * from t1 where bad in (select called f
call bad; call bad; call bad; call bad; call bad; call bad; call bad; call bad;
drop procedure bad;
--enable_query_log
--echo bad() is good.
--echo # bad() is good.
--echo # MDEV-14751 Server crashes in TABLE::versioned on 2nd execution of SP [#431]
create or replace table t1 (called_bad int);
create or replace table t2 (b int);
create or replace procedure bad() select * from t1 where ( 5, 6 ) in ( select b, b from t2 ) and called_bad in ( select max(b) from t2 );
--disable_query_log
call bad; call bad; call bad; call bad; call bad; call bad; call bad; call bad;
drop procedure bad;
--enable_query_log
--echo # bad() is good.
--echo # wildcard expansion on hidden fields.
create or replace table t1(
......
......@@ -18828,6 +18828,12 @@ free_tmp_table(THD *thd, TABLE *entry)
plugin_unlock(0, entry->s->db_plugin);
entry->alias.free();
if (entry->pos_in_table_list && entry->pos_in_table_list->table)
{
DBUG_ASSERT(entry->pos_in_table_list->table == entry);
entry->pos_in_table_list->table= NULL;
}
free_root(&own_root, MYF(0)); /* the table is allocated in its own root */
thd_proc_info(thd, save_proc_info);
......
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