Skip to content
Permalink
Browse files
MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit …
…ints

This problem was earlier fixed by the patch for MDEV-21445.
  • Loading branch information
abarkov committed Jul 6, 2022
1 parent 57f5c31 commit d6e80c2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
@@ -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 #

0 comments on commit d6e80c2

Please sign in to comment.