[MDEV-29753] An error is wrongly reported during INSERT with vcol index Created: 2022-10-10  Updated: 2022-10-18  Resolved: 2022-10-12

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Virtual Columns
Affects Version/s: None
Fix Version/s: 10.3.37, 10.4.27, 10.5.18, 10.6.11, 10.7.7, 10.8.6, 10.9.4, 10.10.2

Type: Bug Priority: Major
Reporter: Nikita Malyavin Assignee: Nikita Malyavin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-29299 SELECT from table with vcol index rep... Closed

 Description   

CREATE TABLE t1(a INT PRIMARY KEY, b INT, vb DATE AS(b) VIRTUAL, KEY(vb))
ENGINE=InnoDB;
INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132);
BEGIN;
DELETE FROM t1;
# error ER_TRUNCATED_WRONG_VALUE Is wrongly reported here
INSERT INTO t1 (a,b) VALUES(1,20190123);
SELECT * FROM t1;
ROLLBACK;
SELECT * FROM t1;
CHECK TABLE t1;
DROP TABLE t1;

The expected behavior is a succeeded insert.

See commits aa8a31da (Bug #22990029 GCOLS: INCORRECT BEHAVIOR AFTER DATA INSERTED WITH IGNORE KEYWORD) and 64678c (Bug #22990029: Add a test case).

That fix is better than incorrect behavior, but the expected behavior is to make an insert.
The insert is truing to delete-unmark the record and for that it needed to recompute the value for the deleted record, which was inserted with IGNORE flag. The correct way would be to set the correcvt sql_mode and thd->abort_on_warning values for that recomputation, so that it always succeeds.

See also MDEV-29299 where the case can be also affected



 Comments   
Comment by Nikita Malyavin [ 2022-10-10 ]

Please review commit b212f4021 [github]

Comment by Nikita Malyavin [ 2022-10-11 ]

Please review commit e978c2 (see the rest of discussion in MDEV-29299)

Comment by Sergei Golubchik [ 2022-10-12 ]

approved, in MDEV-29299

Generated at Thu Feb 08 10:11:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.