Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
11.4.10
-
None
-
debian-linux-gnu / 11.4.10-MariaDB-ubu2404 / mariadb.org binary distribution
-
Not for Release Notes
Description
I observed that a system-versioned table creates a new history version even when an UPDATE statement does not modify any column value.
According to the MariaDB documentation:
“System-versioned tables store the history of all changes”
Source: https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/system-versioned-tables/
In the following example, the UPDATE statement does not change the row values:
CREATE TABLE t1 ( |
x INT UNIQUE, |
y INT |
) WITH SYSTEM VERSIONING; |
|
|
INSERT INTO t1 (x, y) VALUES (1, 1); |
|
|
UPDATE t1 |
SET x = 1; |
|
|
SELECT *, ROW_START, ROW_END |
FROM t1 |
FOR SYSTEM_TIME ALL; |
Expected result
Only one row should exist in history because no data values changed.
Actual result
Two versions are returned.
Although no column value changed, a new history version was created.
Question
Is this behavior intended?
If yes, the documentation may need clarification because it currently refers to storing the history of “changes”, while this behavior appears to version every UPDATE statement regardless of whether row values changed.
Attachments
Issue Links
- duplicates
-
MDEV-31944 UPDATE creates new row in system-versioned tables even if there is no value to change
-
- Closed
-