Skip to content

Commit

Permalink
MDEV-14823, MDEV-15956 Versioning error messages fixes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
midenok authored and vuvova committed May 12, 2018
1 parent ce2cf85 commit b1e75d2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions mysql-test/suite/versioning/r/alter.result
Expand Up @@ -524,5 +524,9 @@ ERROR HY000: System versioning tables in the `mysql` database are not suported
alter table user add system versioning;
ERROR HY000: System versioning tables in the `mysql` database are not suported
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;
create database test;
4 changes: 4 additions & 0 deletions mysql-test/suite/versioning/r/partition.result
Expand Up @@ -479,6 +479,10 @@ insert into t1 values (1),(2),(3);
update t1 set a = 4;
delete from t1;
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
drop database test;
create database test;
5 changes: 5 additions & 0 deletions mysql-test/suite/versioning/t/alter.test
Expand Up @@ -449,5 +449,10 @@ create or replace table t (x int) with system versioning;
alter table user add system versioning;
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;
create database test;
5 changes: 5 additions & 0 deletions mysql-test/suite/versioning/t/partition.test
Expand Up @@ -425,6 +425,11 @@ update t1 set a = 4;
delete from t1;
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
drop database test;
create database test;
2 changes: 1 addition & 1 deletion sql/handler.cc
Expand Up @@ -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)
{
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;
}
}
Expand Down
2 changes: 2 additions & 0 deletions sql/share/errmsg-utf8.txt
Expand Up @@ -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"
ER_EMPTY_ROW_IN_TVC
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"
6 changes: 1 addition & 5 deletions sql/sql_select.cc
Expand Up @@ -793,11 +793,7 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
{
if (vers_conditions.is_set())
{
#define PART_VERS_ERR_MSG "%s PARTITION (%s)"
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);
my_error(ER_VERS_QUERY_IN_PARTITION, MYF(0), table->alias.str);
DBUG_RETURN(-1);
}
else
Expand Down

0 comments on commit b1e75d2

Please sign in to comment.