diff --git a/mysql-test/suite/versioning/r/insert.result b/mysql-test/suite/versioning/r/insert.result index 126d4c1bb23..8752a5294dd 100644 --- a/mysql-test/suite/versioning/r/insert.result +++ b/mysql-test/suite/versioning/r/insert.result @@ -301,6 +301,13 @@ select *, sys_trx_end = 18446744073709551615 as current from t1 for system_time x y current 2 2 1 1 1 0 +create or replace table t1 (i int) with system versioning engine innodb; +insert into t1 values (1),(2); +insert into t1 (sys_trx_start) select sys_trx_end from t1; +ERROR HY000: Column 'sys_trx_start' is not updatable +insert into t1 (sys_trx_start, sys_trx_end) values (DEFAULT, 1); +ERROR HY000: Column 'sys_trx_end' is not updatable +insert into t1 (sys_trx_start, sys_trx_end) values (DEFAULT, DEFAULT); drop table t1; drop table t2; drop procedure test_01; diff --git a/mysql-test/suite/versioning/r/optimized.result b/mysql-test/suite/versioning/r/optimized.result index 4c86b6abbc2..5e951a4b5e2 100644 --- a/mysql-test/suite/versioning/r/optimized.result +++ b/mysql-test/suite/versioning/r/optimized.result @@ -17,59 +17,59 @@ a b b+0 1 NULL NULL 3 NULL NULL Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6); a b 1 NULL 3 NULL Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select count(*) from t group by b for system_time as of timestamp now(6); count(*) 2 Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) order by b asc; a b 1 NULL 3 NULL Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) order by b desc; a b 1 NULL 3 NULL Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select * from t group by a having a=2 for system_time as of timestamp now(6); a b Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select * from t group by b having b=2 for system_time as of timestamp now(6); a b Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select a from t where b=2 for system_time as of timestamp now(6); a Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select a from t where b=NULL for system_time as of timestamp now(6); a Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select a from t where b is NULL for system_time as of timestamp now(6); a 1 3 Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6); count(*) b Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select a, b from t; a b 1 2 @@ -78,29 +78,29 @@ select count(*) from t for system_time as of timestamp now(6) group by b; count(*) 2 Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) group by b having b=2; a b Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b=2; a Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b=NULL; a Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b is NULL; a 1 3 Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL; count(*) b Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query create or replace table t ( a int, b int not null without system versioning @@ -111,12 +111,12 @@ a b 1 NULL 3 NULL Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) where b is NULL; a b 1 NULL 3 NULL Warnings: -Warning 4112 Attempt to read unversioned field `b` in historical query -Warning 4112 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query +Warning 4111 Attempt to read unversioned field `b` in historical query drop table t; diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 1a67436e402..9374281a3fc 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -72,7 +72,7 @@ ERROR HY000: Wrong partitions consistency for `t1`: must have at least one 'VERS alter table t1 add partition ( partition p1 versioning); Warnings: -Warning 4115 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions. +Warning 4114 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions. show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -209,7 +209,7 @@ x 2 delete from t1; Warnings: -Note 4116 Switching from partition `p0` to `p1` +Note 4115 Switching from partition `p0` to `p1` select * from t1 partition (p0) for system_time all; x 1 @@ -219,7 +219,7 @@ x insert into t1 values (3); delete from t1; Warnings: -Warning 4114 Using full partition `p1`, need more VERSIONING partitions! +Warning 4113 Using full partition `p1`, need more VERSIONING partitions! select * from t1 partition (p1) for system_time all; x 2 @@ -252,7 +252,7 @@ x insert into t1 values (4); delete from t1; Warnings: -Note 4116 Switching from partition `p0` to `p1` +Note 4115 Switching from partition `p0` to `p1` select * from t1 partition (p1) for system_time all; x 4 @@ -274,8 +274,8 @@ x 2 delete from t1; Warnings: -Note 4116 Switching from partition `p0` to `p1` -Warning 4114 Using full partition `p1`, need more VERSIONING partitions! +Note 4115 Switching from partition `p0` to `p1` +Warning 4113 Using full partition `p1`, need more VERSIONING partitions! select * from t1 partition (p0sp0) for system_time all; x 1 diff --git a/mysql-test/suite/versioning/t/insert.test b/mysql-test/suite/versioning/t/insert.test index 2c110628daa..c10b8a0a668 100644 --- a/mysql-test/suite/versioning/t/insert.test +++ b/mysql-test/suite/versioning/t/insert.test @@ -203,6 +203,14 @@ insert into t1 values (1, null); update t1 set x= x + 1; select *, sys_trx_end = 18446744073709551615 as current from t1 for system_time all; +create or replace table t1 (i int) with system versioning engine innodb; +insert into t1 values (1),(2); +--error ER_NONUPDATEABLE_COLUMN +insert into t1 (sys_trx_start) select sys_trx_end from t1; +--error ER_NONUPDATEABLE_COLUMN +insert into t1 (sys_trx_start, sys_trx_end) values (DEFAULT, 1); +insert into t1 (sys_trx_start, sys_trx_end) values (DEFAULT, DEFAULT); + drop table t1; drop table t2; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index cb4cb84781d..edfaaf95730 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7815,9 +7815,6 @@ ER_INVALID_VALUE_TO_LIMIT ER_VERSIONING_REQUIRED eng "System Versioning required: %s" -ER_VERS_READONLY_FIELD - eng "System field %`s is read-only" - ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING eng "Rows matched: %ld Changed: %ld Inserted: %ld Warnings: %ld" diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 8983c3646b7..b69e61ed9ae 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8067,12 +8067,11 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN), rfield->field_name.str, table->s->table_name.str); } - if (table->versioned() && rfield->vers_sys_field() && - !ignore_errors) + if (table->versioned() && rfield->vers_sys_field()) { if (type == Item::DEFAULT_VALUE_ITEM) continue; - my_error(ER_VERS_READONLY_FIELD, MYF(0), rfield->field_name.str); + my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), rfield->field_name.str); goto err; } @@ -8308,7 +8307,7 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List &values, if (table->versioned() && field->vers_sys_field() && !ignore_errors) { - my_error(ER_VERS_READONLY_FIELD, MYF(0), field->field_name.str); + my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), field->field_name.str); goto err; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f053bea6b40..6b80a3c98e7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -17632,10 +17632,6 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, share->row_start_field= sys_trx_start->field_index; share->row_end_field= sys_trx_end->field_index; } - else - { - DBUG_ASSERT(!sys_trx_start && !sys_trx_end); - } DBUG_ASSERT(fieldnr == (uint) (reg_field - table->field)); DBUG_ASSERT(field_count >= (uint) (reg_field - table->field));