diff options
-rw-r--r-- | mysql-test/suite/versioning/r/alter.result | 9 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/alter.test | 10 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 6 | ||||
-rw-r--r-- | sql/sql_yacc_ora.yy | 6 |
4 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result index 0c79e6d4a39..2afd3921154 100644 --- a/mysql-test/suite/versioning/r/alter.result +++ b/mysql-test/suite/versioning/r/alter.result @@ -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; diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index ea699104eac..c04c2020460 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.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; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index d5e579e9df5..c1b2fd2294b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -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 { diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 45f770b0c88..28d3d1bf90b 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -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 { |