1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Disable the optimization where a REAL value with no fractional part

is stored as an INTEGER when the integer uses as much space as the real
value it proposes to stand in for (8 bytes).  This avoids corner cases
of comparing integers against real values that are beyond the resolution
of an IEEE 754 double.  Fix for ticket [6c1d3febc00b22d457c78c2]

FossilOrigin-Name: 9b0915272f4d4052aa31e9297424a7db9a0234b676e8e2a44c3f2dc54236705a
This commit is contained in:
drh
2019-05-09 17:10:30 +00:00
parent f6099e9b40
commit 6bab6f2b4d
4 changed files with 65 additions and 9 deletions

View File

@ -261,4 +261,49 @@ do_test select3-8.2 {
}
} {real}
# 2019-05-09 ticket https://www.sqlite.org/src/tktview/6c1d3febc00b22d457c7
#
unset -nocomplain x
foreach {id x} {
100 127
101 128
102 -127
103 -128
104 -129
110 32767
111 32768
112 -32767
113 -32768
114 -32769
120 2147483647
121 2147483648
122 -2147483647
123 -2147483648
124 -2147483649
130 140737488355327
131 140737488355328
132 -140737488355327
133 -140737488355328
134 -140737488355329
140 9223372036854775807
141 -9223372036854775807
142 -9223372036854775808
143 9223372036854775806
144 9223372036854775805
145 -9223372036854775806
146 -9223372036854775805
} {
set x [expr {$x+0}]
do_execsql_test select3-8.$id {
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c0, c1 REAL PRIMARY KEY);
INSERT INTO t1(c0, c1) VALUES (0, $x), (0, 0);
UPDATE t1 SET c0 = NULL;
UPDATE OR REPLACE t1 SET c1 = 1;
SELECT DISTINCT * FROM t1 WHERE (t1.c0 IS NULL);
PRAGMA integrity_check;
} {{} 1.0 ok}
}
finish_test