Commit d6e80c21 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit ints

This problem was earlier fixed by the patch for MDEV-21445.
parent 57f5c319
......@@ -434,5 +434,26 @@ SELECT 9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED);
9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)
1
#
# MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit ints
#
CREATE TABLE betweentest
(
id int(11) unsigned NOT NULL AUTO_INCREMENT,
range1 bigint(20) DEFAULT NULL,
range2 bigint(20) DEFAULT NULL,
PRIMARY KEY (id)
);
INSERT INTO betweentest VALUES
(1,2739499741191602369,2739499741191602369),
(2,2739499741191602192,2739499741191602192),
(3,2739138623713574912,2739138623730352127);
SELECT * FROM betweentest WHERE '2739499741191602192' BETWEEN range1 AND range2;
id range1 range2
2 2739499741191602192 2739499741191602192
SELECT * FROM betweentest WHERE 2739499741191602192 BETWEEN range1 AND range2;
id range1 range2
2 2739499741191602192 2739499741191602192
DROP TABLE betweentest;
#
# End of 10.3 tests
#
......@@ -298,6 +298,30 @@ SELECT CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)=9223372036854775807;
SELECT 9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED);
--echo #
--echo # MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit ints
--echo #
CREATE TABLE betweentest
(
id int(11) unsigned NOT NULL AUTO_INCREMENT,
range1 bigint(20) DEFAULT NULL,
range2 bigint(20) DEFAULT NULL,
PRIMARY KEY (id)
);
INSERT INTO betweentest VALUES
(1,2739499741191602369,2739499741191602369),
(2,2739499741191602192,2739499741191602192),
(3,2739138623713574912,2739138623730352127);
SELECT * FROM betweentest WHERE '2739499741191602192' BETWEEN range1 AND range2;
SELECT * FROM betweentest WHERE 2739499741191602192 BETWEEN range1 AND range2;
DROP TABLE betweentest;
--echo #
--echo # End of 10.3 tests
--echo #
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment