aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-12-22 18:55:04 +0000
committerdrh <drh@noemail.net>2019-12-22 18:55:04 +0000
commit6c1c85ca483154aafa41883253a941f196fa6d03 (patch)
tree894fd0d57c98da083073289cc3618c8f734e2bf0 /src/wherecode.c
parentdb1954be0a639168403ec69639b19e955fc2204d (diff)
downloadsqlite-6c1c85ca483154aafa41883253a941f196fa6d03.tar.gz
sqlite-6c1c85ca483154aafa41883253a941f196fa6d03.zip
Fix to the optimization of check-in [a47efb7c8520a011] that reads the values
of expressions used in an index-on-expression directly from the index rather than recomputing the value. If the expression has a top-level COLLATE or unlikely() operator, be sure to clear the corresponding flags prior to converting it into a TK_COLUMN expression. Failure to do this is most likely harmless in production, but might cause an assertion fault in debugging builds. Ticket [b0cb8aff561a6dcd]. Test cases in TH3. FossilOrigin-Name: 56539e1c132632c075efc217ad5951a35e4459605ac128914aec3a7be1e25718
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index a8ef581da..2f2a27271 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1145,6 +1145,9 @@ static int whereIndexExprTransNode(Walker *p, Expr *pExpr){
pExpr->iTable = pX->iIdxCur;
pExpr->iColumn = pX->iIdxCol;
pExpr->y.pTab = 0;
+ testcase( ExprHasProperty(pExpr, EP_Skip) );
+ testcase( ExprHasProperty(pExpr, EP_Unlikely) );
+ ExprClearProperty(pExpr, EP_Skip|EP_Unlikely);
return WRC_Prune;
}else{
return WRC_Continue;