/ Check-in [0f6ec605]
Login

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

Overview
Comment:Fix a harmless warning about comment formatting in the previous check-in. Simplify the ORDER BY dereferencing logic so that it avoids unreachable branches.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0f6ec605e131ab3d53b9df32af0a3207146a9abbd22dcabd6ef050b92f96735d
User & Date: drh 2018-07-10 07:39:23
Context
2018-07-10
16:04
Enhancements and improved documentation to the byte-code branch coverage testing logic. Provide new macros that allow the code to specify that some branch instructions can never take the NULL path and that the OP_Jump opcode is only interested in equal/not-equal. The SQLITE_TESTCTRL_VDBE_COVERAGE file control callback now works slightly differently (it provides the callback with a bitmask of the branch action, rather than an integer). check-in: cd2da7e1 user: drh tags: trunk
15:45
Merge latest trunk changes into this branch. check-in: e9a3e864 user: dan tags: begin-concurrent
07:39
Fix a harmless warning about comment formatting in the previous check-in. Simplify the ORDER BY dereferencing logic so that it avoids unreachable branches. check-in: 0f6ec605 user: drh tags: trunk
07:25
Assert that if two functions compare equal in every other way, then they must both have OVER clauses, or neither has an OVER clause. Use this fact to simplify expression comparison. check-in: 52559ad5 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  4949   4949       if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
  4950   4950         if( pA->iColumn!=pB->iColumn ) return 2;
  4951   4951         if( pA->iTable!=pB->iTable 
  4952   4952          && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
  4953   4953       }
  4954   4954   #ifndef SQLITE_OMIT_WINDOWFUNC
  4955   4955       /* Justification for the assert():
  4956         -    /* window functions have p->op==TK_FUNCTION but aggregate functions
         4956  +    ** window functions have p->op==TK_FUNCTION but aggregate functions
  4957   4957       ** have p->op==TK_AGG_FUNCTION.  So any comparison between an aggregate
  4958   4958       ** function and a window function should have failed before reaching
  4959   4959       ** this point.  And, it is not possible to have a window function and
  4960   4960       ** a scalar function with the same name and number of arguments.  So
  4961   4961       ** if we reach this point, either A and B both window functions or
  4962   4962       ** neither are a window functions. */
  4963   4963       assert( (pA->pWin==0)==(pB->pWin==0) );

Changes to src/resolve.c.

  1241   1241       if( sqlite3ResolveExprNames(pNC, pE) ){
  1242   1242         return 1;
  1243   1243       }
  1244   1244       for(j=0; j<pSelect->pEList->nExpr; j++){
  1245   1245         if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
  1246   1246   #ifndef SQLITE_OMIT_WINDOWFUNC
  1247   1247           if( pE->pWin ){
         1248  +          /* Since this window function is being changed into a reference
         1249  +          ** to the same window function the result set, remove the instance
         1250  +          ** of this window function from the Select.pWin list. */
  1248   1251             Window **pp;
  1249   1252             for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
  1250   1253               if( *pp==pE->pWin ){
  1251   1254                 *pp = (*pp)->pNextWin;
  1252         -              break;
  1253   1255               }    
  1254   1256             }
  1255   1257           }
  1256   1258   #endif
  1257   1259           pItem->u.x.iOrderByCol = j+1;
  1258   1260         }
  1259   1261       }