SQLite

Check-in [2b23dd24]
Login

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

Overview
Comment:Remove an assert() statement that is no longer valid due to enhancements to query planner for improved use of indexes. Forum post dc16ec63d3.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2b23dd249d0bc254308f5539936d33ee558f1100dec616caac7317dbe70db761
User & Date: drh 2023-04-04 18:10:23
Context
2023-04-04
18:55
Fix an incorrect entry in the array that maps sqlite3_value values into actual datatype numbers. dbsqlfuzz f660c659bcec48577a43d3bab37f46baaa22f59e (check-in: fa8537dc user: drh tags: trunk)
18:48
Remove an assert() statement that is no longer valid due to enhancements to query planner for improved use of indexes. (check-in: 93fb8c66 user: drh tags: branch-3.41)
18:10
Remove an assert() statement that is no longer valid due to enhancements to query planner for improved use of indexes. Forum post dc16ec63d3. (check-in: 2b23dd24 user: drh tags: trunk)
17:35
Expose the new SQLITE_VTAB_USES_ALL_SCHEMAS to JS. (check-in: b7ef09be user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/expr.c.

2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
          colUsed = 0;   /* Columns of index used so far */
          for(i=0; i<nExpr; i++){
            Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);
            Expr *pRhs = pEList->a[i].pExpr;
            CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
            int j;
  
            assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr );
            for(j=0; j<nExpr; j++){
              if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
              assert( pIdx->azColl[j] );
              if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
                continue;
              }
              break;







<







2932
2933
2934
2935
2936
2937
2938

2939
2940
2941
2942
2943
2944
2945
          colUsed = 0;   /* Columns of index used so far */
          for(i=0; i<nExpr; i++){
            Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);
            Expr *pRhs = pEList->a[i].pExpr;
            CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
            int j;
  

            for(j=0; j<nExpr; j++){
              if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
              assert( pIdx->azColl[j] );
              if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
                continue;
              }
              break;

Changes to test/in.test.

825
826
827
828
829
830
831













832
833
834
835
do_execsql_test in-22.3 {
  SELECT * FROM t1 WHERE x IN (((SELECT a FROM t2)));
} {2 200 4 400 6 600}
do_execsql_test in-22.4 {
  SELECT * FROM t1 WHERE x IN ((((((SELECT a FROM t2))))));
} {2 200 4 400 6 600}

















finish_test







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




825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
do_execsql_test in-22.3 {
  SELECT * FROM t1 WHERE x IN (((SELECT a FROM t2)));
} {2 200 4 400 6 600}
do_execsql_test in-22.4 {
  SELECT * FROM t1 WHERE x IN ((((((SELECT a FROM t2))))));
} {2 200 4 400 6 600}

# 2023-04-04 https://sqlite.org/forum/forumpost/dc16ec63d3
# Faulty assert() statement in the IN optimization.
#
do_execsql_test in-23.0 {
  DROP TABLE IF EXISTS t4;
  CREATE TABLE t4(a TEXT, b INT);
  INSERT INTO t4(a,b) VALUES('abc',0),('ABC',1),('def',2);
  CREATE INDEX t4x ON t4(a, +a COLLATE NOCASE);
  SELECT a0.a, group_concat(a1.a) AS b
    FROM t4 AS a0 JOIN t4 AS a1
   GROUP BY a0.a
  HAVING (SELECT sum( (a1.a == +a0.a COLLATE NOCASE) IN (SELECT b FROM t4)));
} {ABC abc,ABC,def abc abc,ABC,def def abc,ABC,def}



finish_test