Commit 0b74c883 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-19127 Assertion `row_start_field' failed in vers_prepare_keys upon ALTER TABLE

Prevent conflicting clauses at parser level.

Clear HA_VERSIONED_TABLE flag for DROP SYSTEM VERSIONING (for the sake
of strictness).
parent 638e7885
......@@ -629,5 +629,14 @@ alter table t1 drop column `row_start`, drop column `row_end`, drop system versi
ERROR 42000: Can't DROP COLUMN `row_start`; check that it exists
alter table t1 drop column `row_end`;
ERROR 42000: Can't DROP COLUMN `row_end`; check that it exists
#
# MDEV-19127 Assertion `row_start_field' failed in vers_prepare_keys upon ALTER TABLE
#
set system_versioning_alter_history=keep;
create or replace table t1 (f1 int) with system versioning;
alter table t1 add f2 int with system versioning, drop system versioning;
create or replace table t1 (f1 int) with system versioning;
alter table t1 drop system versioning, add f2 int with system versioning;
ERROR HY000: Table `t1` is not system-versioned
drop database test;
create database test;
......@@ -528,5 +528,15 @@ alter table t1 drop column `row_start`, drop column `row_end`, drop system versi
--error ER_CANT_DROP_FIELD_OR_KEY
alter table t1 drop column `row_end`;
--echo #
--echo # MDEV-19127 Assertion `row_start_field' failed in vers_prepare_keys upon ALTER TABLE
--echo #
set system_versioning_alter_history=keep;
create or replace table t1 (f1 int) with system versioning;
alter table t1 add f2 int with system versioning, drop system versioning;
create or replace table t1 (f1 int) with system versioning;
--error ER_VERS_NOT_VERSIONED
alter table t1 drop system versioning, add f2 int with system versioning;
drop database test;
create database test;
......@@ -7368,6 +7368,11 @@ serial_attribute:
{
Lex->last_field->versioning= $1;
Lex->create_info.options|= HA_VERSIONED_TABLE;
if (Lex->alter_info.flags & ALTER_DROP_SYSTEM_VERSIONING)
{
my_yyabort_error((ER_VERS_NOT_VERSIONED, MYF(0),
Lex->create_last_non_select_table->table_name.str));
}
}
;
......@@ -8498,6 +8503,7 @@ alter_list_item:
| DROP SYSTEM VERSIONING_SYM
{
Lex->alter_info.flags|= ALTER_DROP_SYSTEM_VERSIONING;
Lex->create_info.options&= ~HA_VERSIONED_TABLE;
}
| DROP PERIOD_SYM FOR_SYSTEM_TIME_SYM
{
......
......@@ -7292,6 +7292,11 @@ serial_attribute:
{
Lex->last_field->versioning= $1;
Lex->create_info.options|= HA_VERSIONED_TABLE;
if (Lex->alter_info.flags & ALTER_DROP_SYSTEM_VERSIONING)
{
my_yyabort_error((ER_VERS_NOT_VERSIONED, MYF(0),
Lex->create_last_non_select_table->table_name.str));
}
}
;
......@@ -8435,6 +8440,7 @@ alter_list_item:
| DROP SYSTEM VERSIONING_SYM
{
Lex->alter_info.flags|= ALTER_DROP_SYSTEM_VERSIONING;
Lex->create_info.options&= ~HA_VERSIONED_TABLE;
}
| DROP PERIOD_SYM FOR_SYSTEM_TIME_SYM
{
......
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