Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a problem that occurred when using a bloom filter to optimize an (ipk = ?) lookup in the case where the RHS of the expression is a TEXT value. First reported by forum post f61a8b7053. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8e14c351b29bb434ac4e2510681e9571 |
User & Date: | dan 2022-10-06 14:10:11 |
Context
2022-10-07
| ||
18:06 | Fix a problem that occurred when using a bloom filter to optimize an (ipk = ?) lookup in the case where the RHS of the expression is a TEXT value. First reported by forum post f61a8b7053. (check-in: dc01d9d8 user: drh tags: branch-3.39) | |
15:55 | Improved tracing output for showing all registers used by the OP_SeekGE opcode. This applies to debugging builds only. (check-in: 0aa6dee7 user: drh tags: trunk) | |
2022-10-06
| ||
14:10 | Fix a problem that occurred when using a bloom filter to optimize an (ipk = ?) lookup in the case where the RHS of the expression is a TEXT value. First reported by forum post f61a8b7053. (check-in: 8e14c351 user: dan tags: trunk) | |
2022-10-04
| ||
14:50 | Attempt to clarify the operation of the xLock and xUnlock VFS I/O methods. Assert() statements added to prove that they behave as the documentation says. (check-in: 3efa8112 user: drh tags: trunk) | |
Changes
Changes to src/wherecode.c.
︙ | ︙ | |||
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | WhereTerm *pTerm = pLoop->aLTerm[0]; int regRowid; assert( pTerm!=0 ); assert( pTerm->pExpr!=0 ); testcase( pTerm->wtFlags & TERM_VIRTUAL ); regRowid = sqlite3GetTempReg(pParse); regRowid = codeEqualityTerm(pParse, pTerm, pLevel, 0, 0, regRowid); sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter, addrNxt, regRowid, 1); VdbeCoverage(pParse->pVdbe); }else{ u16 nEq = pLoop->u.btree.nEq; int r1; char *zStartAff; | > > | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 | WhereTerm *pTerm = pLoop->aLTerm[0]; int regRowid; assert( pTerm!=0 ); assert( pTerm->pExpr!=0 ); testcase( pTerm->wtFlags & TERM_VIRTUAL ); regRowid = sqlite3GetTempReg(pParse); regRowid = codeEqualityTerm(pParse, pTerm, pLevel, 0, 0, regRowid); sqlite3VdbeAddOp2(pParse->pVdbe, OP_MustBeInt, regRowid, addrNxt); VdbeCoverage(pParse->pVdbe); sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter, addrNxt, regRowid, 1); VdbeCoverage(pParse->pVdbe); }else{ u16 nEq = pLoop->u.btree.nEq; int r1; char *zStartAff; |
︙ | ︙ | |||
1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 | assert( pTerm->pExpr!=0 ); testcase( pTerm->wtFlags & TERM_VIRTUAL ); iReleaseReg = ++pParse->nMem; iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); addrNxt = pLevel->addrNxt; if( pLevel->regFilter ){ sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt, iRowidReg, 1); VdbeCoverage(v); filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady); } sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); VdbeCoverage(v); | > > | 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 | assert( pTerm->pExpr!=0 ); testcase( pTerm->wtFlags & TERM_VIRTUAL ); iReleaseReg = ++pParse->nMem; iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); addrNxt = pLevel->addrNxt; if( pLevel->regFilter ){ sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt); VdbeCoverage(v); sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt, iRowidReg, 1); VdbeCoverage(v); filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady); } sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); VdbeCoverage(v); |
︙ | ︙ |
Added test/bloom1.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # 2022 October 06 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # Tests for queries that use bloom filters set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/lock_common.tcl source $testdir/malloc_common.tcl set testprefix bloom1 # Tests 1.* verify that the bloom filter code correctly handles the # case where the RHS of an (<ipk-column> = ?) expression must be coerced # to an integer before the comparison made. # do_execsql_test 1.0 { CREATE TABLE t1(a, b); CREATE TABLE t2(c INTEGER PRIMARY KEY, d); } do_execsql_test 1.1 { INSERT INTO t1 VALUES('hello', 'world'); INSERT INTO t2 VALUES(14, 'fourteen'); } do_execsql_test 1.2 { ANALYZE sqlite_schema; INSERT INTO sqlite_stat1 VALUES('t2','idx1','6 6'); ANALYZE sqlite_schema; } do_execsql_test 1.3 { SELECT 'affinity!' FROM t1 CROSS JOIN t2 WHERE t2.c = '14'; } {affinity!} reset_db do_execsql_test 1.4 { CREATE TABLE t1(a, b TEXT); CREATE TABLE t2(c INTEGER PRIMARY KEY, d); CREATE TABLE t3(e INTEGER PRIMARY KEY, f); ANALYZE sqlite_schema; INSERT INTO sqlite_stat1 VALUES('t1','idx1','600 6'); INSERT INTO sqlite_stat1 VALUES('t2','idx1','6 6'); INSERT INTO sqlite_stat1 VALUES('t3','idx2','6 6'); ANALYZE sqlite_schema; INSERT INTO t1 VALUES(1, '123'); INSERT INTO t2 VALUES(123, 'one'); INSERT INTO t3 VALUES(123, 'two'); } do_execsql_test 1.5 { SELECT 'result' FROM t1, t2, t3 WHERE t2.c=t1.b AND t2.d!='silly' AND t3.e=t1.b AND t3.f!='silly' } {result} finish_test |