mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -437,4 +437,18 @@ update t1 set a = 3 where b <= 9;
|
|||||||
update t2 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;
|
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;
|
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
|
# 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
|
# cleanup
|
||||||
drop tables t1, t2;
|
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
|
--echo # End of 10.4 tests
|
||||||
|
|
||||||
source suite/versioning/common_finish.inc;
|
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)
|
if (error != HA_ERR_RECORD_IS_THE_SAME)
|
||||||
{
|
{
|
||||||
info->updated++;
|
info->updated++;
|
||||||
if (table->versioned())
|
if (table->versioned() &&
|
||||||
|
table->vers_check_update(*info->update_fields))
|
||||||
{
|
{
|
||||||
if (table->versioned(VERS_TIMESTAMP))
|
if (table->versioned(VERS_TIMESTAMP))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user