Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
52559ad58ce412af40f1f34e80bfe9fa |
User & Date: | drh 2018-07-10 07:25:42.133 |
Context
2018-07-10
| ||
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: 0f6ec605e1 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: 52559ad58c user: drh tags: trunk) | |
06:47 | Enhance the sqlite3ExprCompare() routine so that it knows to compare the OVER clause of window functions. (check-in: 0a7649afeb user: drh tags: trunk) | |
Changes
Changes to src/expr.c.
︙ | ︙ | |||
4948 4949 4950 4951 4952 4953 4954 4955 | assert( (combinedFlags & EP_Reduced)==0 ); if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){ if( pA->iColumn!=pB->iColumn ) return 2; if( pA->iTable!=pB->iTable && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; } #ifndef SQLITE_OMIT_WINDOWFUNC if( pA->pWin!=0 ){ | > > > > > > > > > > < < < | 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 | assert( (combinedFlags & EP_Reduced)==0 ); if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){ if( pA->iColumn!=pB->iColumn ) return 2; if( pA->iTable!=pB->iTable && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; } #ifndef SQLITE_OMIT_WINDOWFUNC /* Justification for the assert(): /* window functions have p->op==TK_FUNCTION but aggregate functions ** have p->op==TK_AGG_FUNCTION. So any comparison between an aggregate ** function and a window function should have failed before reaching ** this point. And, it is not possible to have a window function and ** a scalar function with the same name and number of arguments. So ** if we reach this point, either A and B both window functions or ** neither are a window functions. */ assert( (pA->pWin==0)==(pB->pWin==0) ); if( pA->pWin!=0 ){ if( sqlite3WindowCompare(pParse,pA->pWin,pB->pWin)!=0 ) return 2; } #endif } return 0; } /* |
︙ | ︙ |