Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
10.3.9
-
None
-
Windows 10 64Bit
Description
Good Morning,
If you run an update on a non-system versioned table, and the column(s) you update contain the same data, then no rows are updated. However, if you add system versioning to a table, then an update will always update the rows selected by the WHERE clause; regardless of if the values were updated or not.
This has the side effect of unnecessarily increasing the size of the history, as a new history row is created, despite there being no change. I am not certain if this is intended behaviour or not, so I believe as a minimum this should be documented (as SV tables behave differently to normal tables) - however ideally this would be changed, or a configuration option added to control if an no change UPDATE causes a new history row or not.
Test Script
/* Setup */
|
CREATE TABLE `bugTest`.`nsvTable` ( |
`i` INT UNSIGNED NOT NULL, |
PRIMARY KEY (`i`) |
) ENGINE = INNODB;
|
|
INSERT INTO `nsvTable` (`i`) VALUES(1); |
|
CREATE TABLE `bugTest`.`svTable` ( |
`i` INT UNSIGNED NOT NULL, |
PRIMARY KEY (`i`) |
) ENGINE = INNODB WITH SYSTEM VERSIONING; |
|
INSERT INTO `svTable` (`i`) VALUES(1); |
|
/* Test Updates */
|
UPDATE `nsvTable` SET `i` = 1 WHERE `i` = 1; |
/* 0 row(s) affected */
|
|
UPDATE `svTable` SET `i` = 1 WHERE `i` = 1; |
/* 1 row(s) affected */
|
|
/* Cleanup */
|
DROP TABLE `nsvTable`, `svTable`; |
Attachments
Issue Links
- causes
-
MDEV-23446 UPDATE does not insert history row if the row is not changed
- Closed
- relates to
-
MDEV-16226 TRX_ID-based System Versioning refactoring
- Stalled
-
MDEV-23100 ODKU of non-versioning column inserts history row
- Closed