Commit b8b5d8d8 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-14828 Server crashes in JOIN::prepare / setup_fields on 2nd execution of PS [fixes #437]

parent 8efca72f
......@@ -399,5 +399,17 @@ t3 CREATE TABLE `t3` (
`en` SYS_DATATYPE GENERATED ALWAYS AS ROW END INVISIBLE,
PERIOD FOR SYSTEM_TIME (`st`, `en`)
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
# MDEV-14828 Server crashes in JOIN::prepare / setup_fields on 2nd execution of PS [#437]
create or replace table t1 (x int) with system versioning;
prepare bad from 'create or replace table t2 with system versioning as select * from t1';
execute bad;
execute bad;
execute bad;
execute bad;
execute bad;
execute bad;
execute bad;
execute bad;
# bad is good.
drop database test;
create database test;
......@@ -361,5 +361,11 @@ as select x30, y, sys_trx_start, sys_trx_end, st, en from t1, t2;
--replace_result $default_engine DEFAULT_ENGINE $sys_datatype SYS_DATATYPE $sys_datatype_null SYS_DATATYPE $sys_datatype_not_null SYS_DATATYPE $sys_datatype_default_null SYS_DATATYPE
show create table t3;
--echo # MDEV-14828 Server crashes in JOIN::prepare / setup_fields on 2nd execution of PS [#437]
create or replace table t1 (x int) with system versioning;
prepare bad from 'create or replace table t2 with system versioning as select * from t1';
execute bad; execute bad; execute bad; execute bad; execute bad; execute bad; execute bad; execute bad;
--echo # bad is good.
drop database test;
create database test;
......@@ -7093,9 +7093,9 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
DBUG_ASSERT(items);
while (added--)
{
items->push_back(
new (thd->mem_root) Item_default_value(thd, thd->lex->current_context()),
thd->mem_root);
Item_default_value *item= new (thd->mem_root)
Item_default_value(thd, thd->lex->current_context());
items->push_back(item, thd->mem_root);
}
}
......
......@@ -4318,8 +4318,9 @@ TABLE *select_create::create_table_from_items(THD *thd,
int
select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u)
{
List<Item> values(_values, thd->mem_root);
MYSQL_LOCK *extra_lock= NULL;
DBUG_ENTER("select_create::prepare");
......
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