mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug#21555: incorrect behavior with INSERT ... ON DUPL KEY UPDATE and VALUES
VALUES() was considered a constant. This caused replacing (or pre-calculating) it using uninitialized values before the actual execution takes place. Mark it as a non-constant (still not dependent of tables) to prevent the pre-calculation.
This commit is contained in:
@@ -115,4 +115,27 @@ INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a) ;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#21555: incorrect behavior with INSERT ... ON DUPL KEY UPDATE and VALUES
|
||||
#
|
||||
|
||||
|
||||
# End of 4.1 tests
|
||||
CREATE TABLE t1
|
||||
(
|
||||
a BIGINT UNSIGNED,
|
||||
b BIGINT UNSIGNED,
|
||||
PRIMARY KEY (a)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (45, 2) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
Reference in New Issue
Block a user