Details
Description
create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; |
insert into t values (1,'2022-01-01','2023-01-01'); |
create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; |
insert into t (a) values (1); |
select * from t for system_time all; |
|
# Cleanup
|
drop table t; |
bb-10.11-MDEV-16546 2b1d32429 |
create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; |
create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; |
insert into t (a) values (1); |
select * from t for system_time all; |
a s e
|
1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000
|
drop table t; |
Attachments
Issue Links
- is caused by
-
MDEV-16546 System versioning setting to allow history modification
-
- Closed
-
- relates to
-
MDEV-16029 mysqldump: dump and restore historical data
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue is caused by |
Link | This issue relates to TODO-3607 [ TODO-3607 ] |
Link |
This issue relates to |
Affects Version/s | 10.6 [ 24028 ] | |
Affects Version/s | 10.7 [ 24805 ] | |
Affects Version/s | 10.8 [ 26121 ] | |
Affects Version/s | 10.9 [ 26905 ] | |
Affects Version/s | 10.10 [ 27530 ] | |
Affects Version/s | N/A [ 14700 ] |
Summary | system_versioning_insert_history allows to bypass privilege check via trigger | one can modify history via triggers |
Summary | one can modify history via triggers | triggers can modify history |
Affects Version/s | 10.3 [ 22126 ] | |
Affects Version/s | 10.4 [ 22408 ] | |
Affects Version/s | 10.5 [ 23123 ] |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.7 [ 24805 ] | |
Fix Version/s | 10.8 [ 26121 ] | |
Fix Version/s | 10.9 [ 26905 ] | |
Fix Version/s | 10.10 [ 27530 ] | |
Fix Version/s | 10.11 [ 27614 ] |
Description |
{code:sql}
if (`select @@secure_timestamp != 'YES'`) { --die # Run with @@secure_timestamp YES } create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; set system_versioning_insert_history= on; --error ER_OPTION_PREVENTS_STATEMENT insert into t values (1,'2022-01-01','2023-01-01'); create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; insert into t (a) values (1); select * from t for system_time all; # Cleanup drop table t; {code} {code:sql|title=bb-10.11- create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; set system_versioning_insert_history= on; insert into t values (1,'2022-01-01','2023-01-01'); ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; insert into t (a) values (1); select * from t for system_time all; a s e 1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000 drop table t; {code} |
{code:sql}
create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; insert into t values (1,'2022-01-01','2023-01-01'); create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; insert into t (a) values (1); select * from t for system_time all; # Cleanup drop table t; {code} {code:sql|title=bb-10.11- create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; set system_versioning_insert_history= on; insert into t values (1,'2022-01-01','2023-01-01'); ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; insert into t (a) values (1); select * from t for system_time all; a s e 1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000 drop table t; {code} |
Description |
{code:sql}
create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; insert into t values (1,'2022-01-01','2023-01-01'); create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; insert into t (a) values (1); select * from t for system_time all; # Cleanup drop table t; {code} {code:sql|title=bb-10.11- create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; set system_versioning_insert_history= on; insert into t values (1,'2022-01-01','2023-01-01'); ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; insert into t (a) values (1); select * from t for system_time all; a s e 1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000 drop table t; {code} |
{code:sql}
create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; insert into t values (1,'2022-01-01','2023-01-01'); create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; insert into t (a) values (1); select * from t for system_time all; # Cleanup drop table t; {code} {code:sql|title=bb-10.11- create table t (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; create trigger tr before insert on t for each row set new.s = '2022-01-01', new.e = '2023-01-01'; insert into t (a) values (1); select * from t for system_time all; a s e 1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000 drop table t; {code} |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | In Testing [ 10301 ] |
Summary | triggers can modify history | Triggers can modify history |
Fix Version/s | 10.10.2 [ 28410 ] | |
Fix Version/s | 10.9.4 [ 28444 ] | |
Fix Version/s | 10.8.6 [ 28443 ] | |
Fix Version/s | 10.7.7 [ 28442 ] | |
Fix Version/s | 10.6.11 [ 28441 ] | |
Fix Version/s | 10.5.18 [ 28421 ] | |
Fix Version/s | 10.4.27 [ 28405 ] | |
Fix Version/s | 10.3.37 [ 28404 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.7 [ 24805 ] | |
Fix Version/s | 10.8 [ 26121 ] | |
Fix Version/s | 10.9 [ 26905 ] | |
Fix Version/s | 10.10 [ 27530 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Testing [ 10301 ] | Closed [ 6 ] |