Commit 77ffbbca authored by Aleksey Midenkov's avatar Aleksey Midenkov

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.
parent 0c99e6e9
......@@ -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;
......@@ -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;
......@@ -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;
......
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