Commit b1e75d29 authored by Aleksey Midenkov's avatar Aleksey Midenkov Committed by Sergei Golubchik

MDEV-14823, MDEV-15956 Versioning error messages fixes

MDEV-14823 Wrong error message upon selecting from a system_time partition
MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
parent ce2cf855
...@@ -524,5 +524,9 @@ ERROR HY000: System versioning tables in the `mysql` database are not suported ...@@ -524,5 +524,9 @@ ERROR HY000: System versioning tables in the `mysql` database are not suported
alter table user add system versioning; alter table user add system versioning;
ERROR HY000: System versioning tables in the `mysql` database are not suported ERROR HY000: System versioning tables in the `mysql` database are not suported
use test; use test;
# MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
create or replace table t1 (i int, j int as (i), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
alter table t1 modify s timestamp(6) as row start;
ERROR HY000: Can not change system versioning field `s`
drop database test; drop database test;
create database test; create database test;
...@@ -479,6 +479,10 @@ insert into t1 values (1),(2),(3); ...@@ -479,6 +479,10 @@ insert into t1 values (1),(2),(3);
update t1 set a = 4; update t1 set a = 4;
delete from t1; delete from t1;
delete from t1 where a is not null; delete from t1 where a is not null;
# MDEV-14823 Wrong error message upon selecting from a system_time partition
create or replace table t1 (i int) with system versioning partition by system_time limit 10 (partition p0 history, partition pn current);
select * from t1 partition (p0) for system_time all;
ERROR HY000: SYSTEM_TIME partitions in table `t1` does not support historical query
# Test cleanup # Test cleanup
drop database test; drop database test;
create database test; create database test;
...@@ -449,5 +449,10 @@ create or replace table t (x int) with system versioning; ...@@ -449,5 +449,10 @@ create or replace table t (x int) with system versioning;
alter table user add system versioning; alter table user add system versioning;
use test; use test;
--echo # MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
create or replace table t1 (i int, j int as (i), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
--error ER_VERS_ALTER_SYSTEM_FIELD
alter table t1 modify s timestamp(6) as row start;
drop database test; drop database test;
create database test; create database test;
...@@ -425,6 +425,11 @@ update t1 set a = 4; ...@@ -425,6 +425,11 @@ update t1 set a = 4;
delete from t1; delete from t1;
delete from t1 where a is not null; delete from t1 where a is not null;
--echo # MDEV-14823 Wrong error message upon selecting from a system_time partition
create or replace table t1 (i int) with system versioning partition by system_time limit 10 (partition p0 history, partition pn current);
--error ER_VERS_QUERY_IN_PARTITION
select * from t1 partition (p0) for system_time all;
--echo # Test cleanup --echo # Test cleanup
drop database test; drop database test;
create database test; create database test;
...@@ -7055,7 +7055,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info, ...@@ -7055,7 +7055,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
{ {
if (f->change.length && f->flags & VERS_SYSTEM_FIELD) if (f->change.length && f->flags & VERS_SYSTEM_FIELD)
{ {
my_error(ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN, MYF(0)); my_error(ER_VERS_ALTER_SYSTEM_FIELD, MYF(0), f->field_name.str);
return true; return true;
} }
} }
......
...@@ -7915,3 +7915,5 @@ ER_UPDATED_COLUMN_ONLY_ONCE ...@@ -7915,3 +7915,5 @@ ER_UPDATED_COLUMN_ONLY_ONCE
eng "The column %`s.%`s cannot be changed more than once in a single UPDATE statement" eng "The column %`s.%`s cannot be changed more than once in a single UPDATE statement"
ER_EMPTY_ROW_IN_TVC ER_EMPTY_ROW_IN_TVC
eng "Row with no elements is not allowed in table value constructor in this context" eng "Row with no elements is not allowed in table value constructor in this context"
ER_VERS_QUERY_IN_PARTITION
eng "SYSTEM_TIME partitions in table %`s does not support historical query"
...@@ -793,11 +793,7 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables) ...@@ -793,11 +793,7 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
{ {
if (vers_conditions.is_set()) if (vers_conditions.is_set())
{ {
#define PART_VERS_ERR_MSG "%s PARTITION (%s)" my_error(ER_VERS_QUERY_IN_PARTITION, MYF(0), table->alias.str);
char buf[NAME_LEN*2 + sizeof(PART_VERS_ERR_MSG)];
my_snprintf(buf, sizeof(buf), PART_VERS_ERR_MSG, table->alias.str,
table->partition_names->head()->c_ptr());
my_error(ER_VERS_NOT_VERSIONED, MYF(0), buf);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
else else
......
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