Commit c5a83411 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-23100 ODKU of non-versioning column inserts history row

Use vers_check_update() to avoid inserting history row for ODKU if now
versioned fields specified in update_fields.
parent fe618de6
......@@ -437,4 +437,18 @@ update t1 set a = 3 where b <= 9;
update t2 set a = 3 where b <= 9;
update t1, t2 set t1.a = 3, t2.a = 3 where t1.b <= 10 and t2.b <= 10 and t1.b = t2.b;
drop tables t1, t2;
#
# MDEV-23100 ODKU of non-versioning column inserts history row
#
create table t1 (
x int unique,
y int without system versioning
) with system versioning;
insert into t1 (x, y) values ('1', '1');
insert into t1 (x, y) values ('1', '2')
on duplicate key update y = 3;
select x, y, check_row_ts(row_start, row_end) from t1 for system_time all order by row_end;
x y check_row_ts(row_start, row_end)
1 3 CURRENT ROW
drop table t1;
# End of 10.4 tests
......@@ -373,6 +373,22 @@ update t1, t2 set t1.a = 3, t2.a = 3 where t1.b <= 10 and t2.b <= 10 and t1.b =
# cleanup
drop tables t1, t2;
--echo #
--echo # MDEV-23100 ODKU of non-versioning column inserts history row
--echo #
create table t1 (
x int unique,
y int without system versioning
) with system versioning;
insert into t1 (x, y) values ('1', '1');
insert into t1 (x, y) values ('1', '2')
on duplicate key update y = 3;
select x, y, check_row_ts(row_start, row_end) from t1 for system_time all order by row_end;
drop table t1;
--echo # End of 10.4 tests
source suite/versioning/common_finish.inc;
......@@ -1916,7 +1916,8 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (error != HA_ERR_RECORD_IS_THE_SAME)
{
info->updated++;
if (table->versioned())
if (table->versioned() &&
table->vers_check_update(*info->update_fields))
{
if (table->versioned(VERS_TIMESTAMP))
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment