Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.6, 10.11, 11.4, 11.8, 12.3, 13.0
-
None
-
Can result in data loss
Description
Test case
CREATE TABLE bookings (room INT PRIMARY KEY, guest VARCHAR(10), |
checkin DATE, checkout DATE, |
PERIOD FOR stay(checkin, checkout)) ENGINE=InnoDB; |
INSERT INTO bookings VALUES (7, 'alice', '2000-01-01', '2010-01-01'); |
SELECT room, guest, checkin AS period_start, checkout AS period_end FROM bookings; |
|
|
# without IGNORE correctly refused |
UPDATE bookings FOR PORTION OF stay FROM '2002-01-01' TO '2003-01-01' |
SET guest='bob'; |
SELECT room, guest, checkin AS period_start, checkout AS period_end FROM bookings; |
|
|
# Bug: the same statement with IGNORE silently drops the part of the row outside the portion |
UPDATE IGNORE bookings FOR PORTION OF stay FROM '2002-01-01' TO '2003-01-01' |
SET guest='bob'; |
SELECT ROW_COUNT(); |
SELECT room, guest, checkin AS period_start, checkout AS period_end FROM bookings; |
CLI Output
10.6.28-opt>CREATE TABLE bookings (room INT PRIMARY KEY, guest VARCHAR(10), |
-> checkin DATE, checkout DATE, |
-> PERIOD FOR stay(checkin, checkout)) ENGINE=InnoDB; |
out AS period_end FROM bookings; |
|
|
DROP TABLE bookings;Query OK, 0 rows affected (0.017 sec) |
|
|
10.6.28-opt>INSERT INTO bookings VALUES (7, 'alice', '2000-01-01', '2010-01-01'); |
Query OK, 1 row affected (0.003 sec)
|
|
|
10.6.28-opt>SELECT room, guest, checkin AS period_start, checkout AS period_end FROM bookings; |
+------+-------+--------------+------------+ |
| room | guest | period_start | period_end |
|
+------+-------+--------------+------------+ |
| 7 | alice | 2000-01-01 | 2010-01-01 |
|
+------+-------+--------------+------------+ |
1 row in set (0.000 sec) |
|
|
10.6.28-opt>
|
|
|
# without IGNORE correctly refused |
10.6.28-opt>UPDATE bookings FOR PORTION OF stay FROM '2002-01-01' TO '2003-01-01' |
-> SET guest='bob'; |
ERROR 1062 (23000): Duplicate entry '7' for key 'PRIMARY' |
10.6.28-opt>SELECT room, guest, checkin AS period_start, checkout AS period_end FROM bookings; |
+------+-------+--------------+------------+ |
| room | guest | period_start | period_end |
|
+------+-------+--------------+------------+ |
| 7 | alice | 2000-01-01 | 2010-01-01 |
|
+------+-------+--------------+------------+ |
1 row in set (0.000 sec) |
|
|
10.6.28-opt>
|
# Bug: the same statement with IGNORE silently drops the part of the row outside the portion |
10.6.28-opt>UPDATE IGNORE bookings FOR PORTION OF stay FROM '2002-01-01' TO '2003-01-01' |
-> SET guest='bob'; |
Query OK, 1 row affected (0.001 sec)
|
Rows matched: 1 Changed: 1 Inserted: 0 Warnings: 0 |
|
|
10.6.28-opt>SELECT room, guest, checkin AS period_start, checkout AS period_end FROM bookings; |
+------+-------+--------------+------------+ |
| room | guest | period_start | period_end |
|
+------+-------+--------------+------------+ |
| 7 | bob | 2002-01-01 | 2003-01-01 |
|
+------+-------+--------------+------------+ |
1 row in set (0.000 sec) |
|
|
10.6.28-opt>
|
Attachments
Issue Links
- relates to
-
MDEV-22548 Assertion `0' failed in Protocol::end_statement upon multi-table DELETE IGNORE from system- and application-versioned table
-
- Confirmed
-