diff options
author | dan <dan@noemail.net> | 2019-12-23 14:20:46 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2019-12-23 14:20:46 +0000 |
commit | 2811ea6be7f4d63d5cc0992c78db3b1b73112a93 (patch) | |
tree | eb39187f22c7c7d3e140fec06d65a5608ecc7dd4 /src/wherecode.c | |
parent | 7edce5ecc0aa8dc146ffe07fb2bdbe814f125790 (diff) | |
download | sqlite-2811ea6be7f4d63d5cc0992c78db3b1b73112a93.tar.gz sqlite-2811ea6be7f4d63d5cc0992c78db3b1b73112a93.zip |
For expressions like (x, y) IN (SELECT ...) where the SELECT uses window-functions, require that all columns on the LHS be indexed before an index can be used. Fix for [d9ed4ebe].
FossilOrigin-Name: 0b1dbd60f5db3abe2097dbc0b6de9671685ca5eaf7d3fc8e3f87ff5065a9d114
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index 2f2a27271..d5d340374 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -416,23 +416,6 @@ static Expr *removeUnindexableInClauseTerms( ){ sqlite3 *db = pParse->db; Expr *pNew; -#ifndef SQLITE_OMIT_WINDOWFUNC - /* The SELECT statement at pX->x.pSelect has already been resolved. This - ** means that its window functions have already been identified and - ** linked into the Select.pWin list. However, if there are multiple - ** window functions and they do not all use the same window frame, only - ** those that use the same window frame as the first resolved are listed - ** in Select.pWin. Any others are delegated to sub-selects created by the - ** call to sqlite3WindowRewrite() made when coding the SELECT statement. - ** But - sqlite3WindowRewrite() is a no-op if Select.pWin==0. And if - ** removing the unindexable terms happens to remove all window functions - ** in the Select.pWin list, then Select.pWin ends up set to NULL - meaning - ** that the other window functions are never processed. To work around - ** this, ensure that sqlite3WindowRewrite() has been called to create the - ** required sub-selects before the unindexable terms are removed. See - ** ticket #f00d096ca. */ - if( sqlite3WindowRewrite(pParse, pX->x.pSelect) ) return 0; -#endif pNew = sqlite3ExprDup(db, pX, 0); if( db->mallocFailed==0 ){ ExprList *pOrigRhs = pNew->x.pSelect->pEList; /* Original unmodified RHS */ |