(text/x-fossil-wiki)
Imprecision in the comparison of integer and floating-point values can
result in a corrupt index. The following SQL demonstrates:
<blockquote><verbatim>
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
CREATE INDEX t1b ON t1(b);
INSERT INTO t1(a,b) VALUES(3, 356282677878746339);
INSERT INTO t1(a,b) VALUES(2, 356282677878746339.0);
INSERT INTO t1(a,b) VALUES(1, 356282677878746340);
DELETE FROM t1 WHERE a=2;
PRAGMA integrity_check;
</verbatim></blockquote>
The integrity_check reports a row missing from the index. Examination of
the binary for the resulting databases shows that the index has two rows
but that the rows are out-of-order.
The above is true when compiling with gcc on linux. But using MSVC on Windows,
the script works correctly.
This bug has existed in the code since before version 3.5.1 (circa 2007).
|