mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
SQL: DEFAULT value for system fields [closes #376]
This commit is contained in:
@ -120,10 +120,13 @@ insert into t1(x, y) values
|
|||||||
(3, 3001),
|
(3, 3001),
|
||||||
(4, 4001),
|
(4, 4001),
|
||||||
(5, 5001),
|
(5, 5001),
|
||||||
(6, 6001),
|
(6, 6001);
|
||||||
(7, 7001),
|
insert into t1(x, y, sys_start) values
|
||||||
(8, 8001),
|
(7, 7001, DEFAULT);
|
||||||
(9, 9001);
|
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';
|
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 t1;
|
||||||
select x, y from t2;
|
select x, y from t2;
|
||||||
@ -259,6 +262,9 @@ No A B C D
|
|||||||
13 1 1 1 1
|
13 1 1 1 1
|
||||||
14 1 1 1 1
|
14 1 1 1 1
|
||||||
15 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(
|
create table t1(
|
||||||
x int unsigned,
|
x int unsigned,
|
||||||
sys_start bigint unsigned generated always as row start,
|
sys_start bigint unsigned generated always as row start,
|
||||||
|
@ -127,10 +127,13 @@ begin
|
|||||||
(3, 3001),
|
(3, 3001),
|
||||||
(4, 4001),
|
(4, 4001),
|
||||||
(5, 5001),
|
(5, 5001),
|
||||||
(6, 6001),
|
(6, 6001);
|
||||||
(7, 7001),
|
insert into t1(x, y, sys_start) values
|
||||||
(8, 8001),
|
(7, 7001, DEFAULT);
|
||||||
(9, 9001);
|
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';
|
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 t1;
|
||||||
select x, y from t2;
|
select x, y from t2;
|
||||||
|
@ -8045,6 +8045,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
|
|||||||
if (table->versioned() && rfield->vers_sys_field() &&
|
if (table->versioned() && rfield->vers_sys_field() &&
|
||||||
!ignore_errors)
|
!ignore_errors)
|
||||||
{
|
{
|
||||||
|
if (type == Item::DEFAULT_VALUE_ITEM)
|
||||||
|
continue;
|
||||||
my_error(ER_VERS_READONLY_FIELD, MYF(0), rfield->field_name.str);
|
my_error(ER_VERS_READONLY_FIELD, MYF(0), rfield->field_name.str);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user