SQLite

Check-in [4ec0f0a3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change the RTREE engine so that equality comparisons of floating point values are duplicated in the byte-code so that the comparisons are done using 64-bit floats and consistent results are always obtained. Forum post da61c4a1b5b4af19.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4ec0f0a31b0df93ad15545fe1db117c933e28c75ad3cbc8475b56fecdb084905
User & Date: drh 2023-05-19 11:48:05
Context
2023-05-19
12:41
Correct typo in an 'extern' decl name, reported in forum post 1d4342156439233b. (check-in: 6ac18827 user: stephan tags: trunk)
11:48
Change the RTREE engine so that equality comparisons of floating point values are duplicated in the byte-code so that the comparisons are done using 64-bit floats and consistent results are always obtained. Forum post da61c4a1b5b4af19. (check-in: 4ec0f0a3 user: drh tags: trunk)
2023-05-18
23:25
Fix incorrect b-tree root page reports from the enhanced PRAGMA integrity_check output introduced in version 3.42.0. (check-in: 9b538f62 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/rtree/rtree.c.

2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
        case SQLITE_INDEX_CONSTRAINT_MATCH: op = RTREE_MATCH; break;
        default:                            op = 0;           break;
      }
      if( op ){
        zIdxStr[iIdx++] = op;
        zIdxStr[iIdx++] = (char)(p->iColumn - 1 + '0');
        pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2);
        pIdxInfo->aConstraintUsage[ii].omit = 1;
      }
    }
  }

  pIdxInfo->idxNum = 2;
  pIdxInfo->needToFreeIdxStr = 1;
  if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){







|







2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
        case SQLITE_INDEX_CONSTRAINT_MATCH: op = RTREE_MATCH; break;
        default:                            op = 0;           break;
      }
      if( op ){
        zIdxStr[iIdx++] = op;
        zIdxStr[iIdx++] = (char)(p->iColumn - 1 + '0');
        pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2);
        pIdxInfo->aConstraintUsage[ii].omit = (op!=RTREE_EQ);
      }
    }
  }

  pIdxInfo->idxNum = 2;
  pIdxInfo->needToFreeIdxStr = 1;
  if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){

Changes to ext/rtree/rtree1.test.

751
752
753
754
755
756
757














758
759
db null -
do_execsql_test 20.3 {
  SELECT * FROM t1 JOIN t0 ON true RIGHT JOIN rt0 ON x0>a WHERE +x0 = 0;
} {- - 0 0.0 0.0}
do_execsql_test 20.4 {
  SELECT * FROM t1 JOIN t0 ON true RIGHT JOIN rt0 ON x0>a WHERE x0 = 0;
} {- - 0 0.0 0.0}















finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>


751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
db null -
do_execsql_test 20.3 {
  SELECT * FROM t1 JOIN t0 ON true RIGHT JOIN rt0 ON x0>a WHERE +x0 = 0;
} {- - 0 0.0 0.0}
do_execsql_test 20.4 {
  SELECT * FROM t1 JOIN t0 ON true RIGHT JOIN rt0 ON x0>a WHERE x0 = 0;
} {- - 0 0.0 0.0}

# 2023-05-19 https://sqlite.org/forum/forumpost/da61c4a1b5b4af19
# Do not omit constraints that involve equality comparisons of
# floating-point values.
#
reset_db
do_execsql_test 21.0 {
  CREATE VIRTUAL TABLE t1 USING rtree(id, x0, x1);
  INSERT INTO t1 VALUES(0, 1, 9223372036854775807);
  SELECT count(*) FROM t1 WHERE x1=9223372036854775807;
} {0}
do_execsql_test 21.1 {
 SELECT x1=9223372036854775807 FROM t1;
} {0}

finish_test