summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/versioning/r/insert.result14
-rw-r--r--mysql-test/suite/versioning/t/insert.test11
-rw-r--r--sql/sql_base.cc2
3 files changed, 19 insertions, 8 deletions
diff --git a/mysql-test/suite/versioning/r/insert.result b/mysql-test/suite/versioning/r/insert.result
index 38e224ae5e3..126d4c1bb23 100644
--- a/mysql-test/suite/versioning/r/insert.result
+++ b/mysql-test/suite/versioning/r/insert.result
@@ -120,10 +120,13 @@ insert into t1(x, y) values
(3, 3001),
(4, 4001),
(5, 5001),
-(6, 6001),
-(7, 7001),
-(8, 8001),
-(9, 9001);
+(6, 6001);
+insert into t1(x, y, sys_start) values
+(7, 7001, DEFAULT);
+insert into t1(x, y, sys_end) values
+(8, 8001, DEFAULT);
+insert into t1(x, y, sys_start, sys_end) values
+(9, 9001, DEFAULT, DEFAULT);
insert into t2 select x, y from t1 for system_time between timestamp '0000-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
select x, y from t1;
select x, y from t2;
@@ -259,6 +262,9 @@ No A B C D
13 1 1 1 1
14 1 1 1 1
15 1 1 1 1
+16 1 1 1 1
+17 1 1 1 1
+18 1 1 1 1
create table t1(
x int unsigned,
sys_start bigint unsigned generated always as row start,
diff --git a/mysql-test/suite/versioning/t/insert.test b/mysql-test/suite/versioning/t/insert.test
index b7fda5db1b5..2c110628daa 100644
--- a/mysql-test/suite/versioning/t/insert.test
+++ b/mysql-test/suite/versioning/t/insert.test
@@ -127,10 +127,13 @@ begin
(3, 3001),
(4, 4001),
(5, 5001),
- (6, 6001),
- (7, 7001),
- (8, 8001),
- (9, 9001);
+ (6, 6001);
+ insert into t1(x, y, sys_start) values
+ (7, 7001, DEFAULT);
+ insert into t1(x, y, sys_end) values
+ (8, 8001, DEFAULT);
+ insert into t1(x, y, sys_start, sys_end) values
+ (9, 9001, DEFAULT, DEFAULT);
insert into t2 select x, y from t1 for system_time between timestamp '0000-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
select x, y from t1;
select x, y from t2;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index d4de5bf1405..2a3a2903b35 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -8045,6 +8045,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
if (table->versioned() && rfield->vers_sys_field() &&
!ignore_errors)
{
+ if (type == Item::DEFAULT_VALUE_ITEM)
+ continue;
my_error(ER_VERS_READONLY_FIELD, MYF(0), rfield->field_name.str);
goto err;
}