Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make sure indexes on expressions skip over initial NULL values in the index. Fix for ticket [4baa464912129477f3c9] |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
71797ba431085f9ae381ed5ea6471967 |
User & Date: | drh 2016-10-10 13:29:15.581 |
Context
2016-10-10
| ||
14:34 | When handling ORDER BY expressions, do not assume all values of an indexed expressions are distinct. Fix for [4766f444]. (check-in: aebe429e52 user: dan tags: trunk) | |
13:29 | Make sure indexes on expressions skip over initial NULL values in the index. Fix for ticket [4baa464912129477f3c9] (check-in: 71797ba431 user: drh tags: trunk) | |
10:06 | Fix a case in which the rtree module was ignoring an OOM while generating an error message. (check-in: 788f86bebe user: dan tags: trunk) | |
Changes
Changes to src/wherecode.c.
︙ | ︙ | |||
1442 1443 1444 1445 1446 1447 1448 | testcase( bRev ); testcase( pIdx->aSortOrder[nEq]==SQLITE_SO_DESC ); assert( (bRev & ~1)==0 ); pLevel->iLikeRepCntr <<=1; pLevel->iLikeRepCntr |= bRev ^ (pIdx->aSortOrder[nEq]==SQLITE_SO_DESC); } #endif | | | | < | > | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 | testcase( bRev ); testcase( pIdx->aSortOrder[nEq]==SQLITE_SO_DESC ); assert( (bRev & ~1)==0 ); pLevel->iLikeRepCntr <<=1; pLevel->iLikeRepCntr |= bRev ^ (pIdx->aSortOrder[nEq]==SQLITE_SO_DESC); } #endif if( pRangeStart==0 ){ j = pIdx->aiColumn[nEq]; if( (j>=0 && pIdx->pTable->aCol[j].notNull==0) || j==XN_EXPR ){ bSeekPastNull = 1; } } } assert( pRangeEnd==0 || (pRangeEnd->wtFlags & TERM_VNULL)==0 ); /* If we are doing a reverse order scan on an ascending index, or ** a forward order scan on a descending index, interchange the ** start and end terms (pRangeStart and pRangeEnd). |
︙ | ︙ |
Changes to test/indexexpr1.test.
︙ | ︙ | |||
319 320 321 322 323 324 325 326 327 | SELECT *, '|' FROM t0 ORDER BY +a; } {0 1 2 | 2 99 4 | 5 99 7 |} do_execsql_test indexexpr1-1010 { UPDATE t0 SET b=88 WHERE (a in(0,1))=1; SELECT *, '|' FROM t0 ORDER BY +a; } {0 88 2 | 2 99 4 | 5 99 7 |} finish_test | > > > > > > > > > > > > > > > > | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | SELECT *, '|' FROM t0 ORDER BY +a; } {0 1 2 | 2 99 4 | 5 99 7 |} do_execsql_test indexexpr1-1010 { UPDATE t0 SET b=88 WHERE (a in(0,1))=1; SELECT *, '|' FROM t0 ORDER BY +a; } {0 88 2 | 2 99 4 | 5 99 7 |} # 2016-10-10 # Make sure indexes on expressions skip over initial NULL values in the # index as they are suppose to do. # Ticket https://www.sqlite.org/src/tktview/4baa46491212947 # do_execsql_test indexexpr1-1100 { DROP TABLE IF EXISTS t1; CREATE TABLE t1(a); INSERT INTO t1 VALUES(NULL),(1); SELECT '1:', typeof(a), a FROM t1 WHERE a<10; SELECT '2:', typeof(a), a FROM t1 WHERE a+0<10; CREATE INDEX t1x1 ON t1(a); CREATE INDEX t1x2 ON t1(a+0); SELECT '3:', typeof(a), a FROM t1 WHERE a<10; SELECT '4:', typeof(a), a FROM t1 WHERE a+0<10; } {1: integer 1 2: integer 1 3: integer 1 4: integer 1} finish_test |