Commit d31f9537 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-22660 SIGSEGV on adding system versioning and modifying system column

Second alter subcommand correctly removed VERS_ROW_END flag. We throw
ER_VERS_PERIOD_COLUMNS in such case.
parent 911c803d
...@@ -759,3 +759,22 @@ delete from t1; ...@@ -759,3 +759,22 @@ delete from t1;
set system_versioning_alter_history= keep; set system_versioning_alter_history= keep;
alter ignore table t1 drop pk; alter ignore table t1 drop pk;
drop table t1; drop table t1;
#
# MDEV-22660 SIGSEGV on adding system versioning and modifying system column
#
create or replace table t1 (a int);
alter table t1
add row_start timestamp(6) as row start,
add row_end timestamp(6) as row end,
add period for system_time(row_start, row_end),
with system versioning,
modify row_end varchar(8);
ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `row_start` and `row_end`
alter table t1
add row_start timestamp(6) as row start,
add row_end timestamp(6) as row end,
add period for system_time(row_start, row_end),
with system versioning,
modify row_start varchar(8);
ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `row_start` and `row_end`
drop table t1;
...@@ -652,3 +652,25 @@ set system_versioning_alter_history= keep; ...@@ -652,3 +652,25 @@ set system_versioning_alter_history= keep;
alter ignore table t1 drop pk; alter ignore table t1 drop pk;
# cleanup # cleanup
drop table t1; drop table t1;
--echo #
--echo # MDEV-22660 SIGSEGV on adding system versioning and modifying system column
--echo #
create or replace table t1 (a int);
--error ER_VERS_PERIOD_COLUMNS
alter table t1
add row_start timestamp(6) as row start,
add row_end timestamp(6) as row end,
add period for system_time(row_start, row_end),
with system versioning,
modify row_end varchar(8);
--error ER_VERS_PERIOD_COLUMNS
alter table t1
add row_start timestamp(6) as row start,
add row_end timestamp(6) as row end,
add period for system_time(row_start, row_end),
with system versioning,
modify row_start varchar(8);
# cleanup
drop table t1;
...@@ -7564,6 +7564,12 @@ bool Vers_parse_info::check_sys_fields(const Lex_table_name &table_name, ...@@ -7564,6 +7564,12 @@ bool Vers_parse_info::check_sys_fields(const Lex_table_name &table_name,
row_end= f; row_end= f;
} }
if (!row_start || !row_end)
{
my_error(ER_VERS_PERIOD_COLUMNS, MYF(0), as_row.start.str, as_row.end.str);
return true;
}
if (!can_native || if (!can_native ||
!row_start->is_some_bigint() || !row_start->is_some_bigint() ||
!row_end->is_some_bigint()) !row_end->is_some_bigint())
......
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