aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-02-08 04:15:19 +0000
committerdrh <drh@noemail.net>2019-02-08 04:15:19 +0000
commit8851e10017893cfaf88acf80e223149fea1a1a37 (patch)
treeb1a543a8bc4cf2ea62dae7787b9a5cba1ba16aef /src
parent1e30c7f369856fdbf4b4040dfaa63b9eab64302f (diff)
downloadsqlite-8851e10017893cfaf88acf80e223149fea1a1a37.tar.gz
sqlite-8851e10017893cfaf88acf80e223149fea1a1a37.zip
Do not do the optimization that attempts to pull expression values from
an index on that expression when processing a multi-index OR (see check-in [a47efb7c8520a0111]) because the expression transformations that are applied become invalid when the processing moves off of the current index and on to the next index. Fix for ticket [4e8e4857d32d401f]. FossilOrigin-Name: 440a7cda000164d3b46109caf2e1dde80681ba9b0d94ba9be6847d2b917445cf
Diffstat (limited to 'src')
-rw-r--r--src/wherecode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index cffa78959..19315779b 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1756,8 +1756,13 @@ Bitmask sqlite3WhereCodeOneLoopStart(
** the cursor. In this case it is important to do the full evaluation,
** as the result of the expression may not be NULL, even if all table
** column values are. https://www.sqlite.org/src/info/7fa8049685b50b5a
+ **
+ ** Also, do not do this when processing one index an a multi-index
+ ** OR clause, since the transformation will become invalid once we
+ ** move forward to the next index.
+ ** https://sqlite.org/src/info/4e8e4857d32d401f
*/
- if( pLevel->iLeftJoin==0 ){
+ if( pLevel->iLeftJoin==0 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){
whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo);
}