1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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
This commit is contained in:
Aleksey Midenkov
2018-04-24 12:10:52 +03:00
committed by Sergei Golubchik
parent ce2cf855bf
commit b1e75d290e
7 changed files with 22 additions and 6 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
} }
} }

View File

@ -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"

View File

@ -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