diff options
author | tnurnberg@white.intern.koehntopp.de <> | 2008-03-27 03:16:35 +0100 |
---|---|---|
committer | tnurnberg@white.intern.koehntopp.de <> | 2008-03-27 03:16:35 +0100 |
commit | e09d9838259f831c27c546a2fea3a24e6b432733 (patch) | |
tree | 01e325edb526b25c63501addcdc0821b87a28d48 /mysql-test/t/range.test | |
parent | 3bff5b59c669fa14645fb4705b2406bd2ba0e120 (diff) | |
parent | 3db8534ed4948aa62d29bc40741e802f76dd5611 (diff) | |
download | mariadb-git-e09d9838259f831c27c546a2fea3a24e6b432733.tar.gz |
Merge mysql.com:/misc/mysql/34731_/50-34731
into mysql.com:/misc/mysql/34731/50-34731
Diffstat (limited to 'mysql-test/t/range.test')
-rw-r--r-- | mysql-test/t/range.test | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 1352b366508..cdbedb1f848 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -972,4 +972,50 @@ EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; DROP TABLE t1; +# +# Bug #34731: highest possible value for INT erroneously filtered by WHERE +# + +# test UNSIGNED. only occurs when indexed. +CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1)); + +INSERT INTO t1 VALUES (127),(254),(0),(1),(255); + +# test upper bound +# count 5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256; +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256.0; +# count 4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 255; + +# show we don't fiddle with lower bound on UNSIGNED +# count 0 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < -1; +# count 5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -1; + +DROP TABLE t1; + + +# test signed. only occurs when index. +CREATE TABLE t1 ( f1 TINYINT(11) NOT NULL, PRIMARY KEY (f1)); + +INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127); + +# test upper bound +# count 5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128; +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128.0; +# count 4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 127; + +# test lower bound +# count 5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129; +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129.0; +# count 4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -128; + +DROP TABLE t1; + # End of 5.0 tests |