Skip to content

Commit d6e80c2

Browse files
committed
MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit ints
This problem was earlier fixed by the patch for MDEV-21445.
1 parent 57f5c31 commit d6e80c2

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

mysql-test/main/type_int.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,5 +434,26 @@ SELECT 9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED);
434434
9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)
435435
1
436436
#
437+
# MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit ints
438+
#
439+
CREATE TABLE betweentest
440+
(
441+
id int(11) unsigned NOT NULL AUTO_INCREMENT,
442+
range1 bigint(20) DEFAULT NULL,
443+
range2 bigint(20) DEFAULT NULL,
444+
PRIMARY KEY (id)
445+
);
446+
INSERT INTO betweentest VALUES
447+
(1,2739499741191602369,2739499741191602369),
448+
(2,2739499741191602192,2739499741191602192),
449+
(3,2739138623713574912,2739138623730352127);
450+
SELECT * FROM betweentest WHERE '2739499741191602192' BETWEEN range1 AND range2;
451+
id range1 range2
452+
2 2739499741191602192 2739499741191602192
453+
SELECT * FROM betweentest WHERE 2739499741191602192 BETWEEN range1 AND range2;
454+
id range1 range2
455+
2 2739499741191602192 2739499741191602192
456+
DROP TABLE betweentest;
457+
#
437458
# End of 10.3 tests
438459
#

mysql-test/main/type_int.test

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,30 @@ SELECT CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)=9223372036854775807;
298298
SELECT 9223372036854775807=CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED);
299299

300300

301+
--echo #
302+
--echo # MDEV-25492 BETWEEN clause returns incorrect results on quoted 64-bit ints
303+
--echo #
304+
305+
CREATE TABLE betweentest
306+
(
307+
id int(11) unsigned NOT NULL AUTO_INCREMENT,
308+
range1 bigint(20) DEFAULT NULL,
309+
range2 bigint(20) DEFAULT NULL,
310+
PRIMARY KEY (id)
311+
);
312+
313+
INSERT INTO betweentest VALUES
314+
(1,2739499741191602369,2739499741191602369),
315+
(2,2739499741191602192,2739499741191602192),
316+
(3,2739138623713574912,2739138623730352127);
317+
318+
SELECT * FROM betweentest WHERE '2739499741191602192' BETWEEN range1 AND range2;
319+
320+
SELECT * FROM betweentest WHERE 2739499741191602192 BETWEEN range1 AND range2;
321+
322+
DROP TABLE betweentest;
323+
324+
301325
--echo #
302326
--echo # End of 10.3 tests
303327
--echo #

0 commit comments

Comments
 (0)