diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2021-03-24 20:34:16 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2021-03-31 21:25:41 +0300 |
commit | 77ffbbca49064291817430cd29afc160dfe4a706 (patch) | |
tree | 5ddf98aee497b77398d1a6bc462f5a799f9c68a0 | |
parent | 0c99e6e9a6a5a64b0d757d796ab53d361e7fb001 (diff) | |
download | mariadb-git-77ffbbca49064291817430cd29afc160dfe4a706.tar.gz |
MDEV-25172 Wrong error message for ADD COLUMN .. AS ROW START
Handle one more condition in fix_alter_info() for non-versioned table
and produce ER_VERS_NOT_VERSIONED error.
-rw-r--r-- | mysql-test/suite/versioning/r/alter.result | 9 | ||||
-rw-r--r-- | mysql-test/suite/versioning/t/alter.test | 11 | ||||
-rw-r--r-- | sql/handler.cc | 5 |
3 files changed, 23 insertions, 2 deletions
diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result index 9d79b6e73c5..3666a5ddcb1 100644 --- a/mysql-test/suite/versioning/r/alter.result +++ b/mysql-test/suite/versioning/r/alter.result @@ -80,7 +80,7 @@ t CREATE TABLE `t` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t add column trx_start timestamp(6) as row start; -ERROR HY000: Duplicate ROW START column `trx_start` +ERROR HY000: Table `t` is not system-versioned alter table t add system versioning; show create table t; Table Create Table @@ -735,3 +735,10 @@ t1 CREATE TABLE `t1` ( alter table t1 drop column b; ERROR 42000: Key column 'b' doesn't exist in table drop table t1; +# +# MDEV-25172 Wrong error message for ADD COLUMN .. AS ROW START +# +create or replace table t1 (x int); +alter table t1 add column y timestamp(6) as row start; +ERROR HY000: Table `t1` is not system-versioned +drop table t1; diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index 90ecbfd9f79..91bddb5aaeb 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -68,7 +68,7 @@ select row_start from t; alter table t drop system versioning; show create table t; ---error ER_VERS_DUPLICATE_ROW_START_END +--error ER_VERS_NOT_VERSIONED alter table t add column trx_start timestamp(6) as row start; alter table t add system versioning; @@ -621,3 +621,12 @@ alter table t1 drop column b; # cleanup drop table t1; + +--echo # +--echo # MDEV-25172 Wrong error message for ADD COLUMN .. AS ROW START +--echo # +create or replace table t1 (x int); +--error ER_VERS_NOT_VERSIONED +alter table t1 add column y timestamp(6) as row start; +# cleanup +drop table t1; diff --git a/sql/handler.cc b/sql/handler.cc index 334ed2d8be2..c0a810a72bc 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7340,6 +7340,11 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info, { if (f->flags & VERS_SYSTEM_FIELD) { + if (!table->versioned()) + { + my_error(ER_VERS_NOT_VERSIONED, MYF(0), table->s->table_name.str); + return true; + } my_error(ER_VERS_DUPLICATE_ROW_START_END, MYF(0), f->flags & VERS_SYS_START_FLAG ? "START" : "END", f->field_name.str); return true; |