aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-01-08 01:43:47 +0000
committerdrh <drh@noemail.net>2020-01-08 01:43:47 +0000
commitc9301e6e7c03d876be80b415783f99cf50f83ec8 (patch)
tree954c09ffd60fc79bdf924e0a6fb8aabbb3a84a3d /src/select.c
parent97bffe674f4d40e03a7bd72c07dc5f1a39858bfd (diff)
downloadsqlite-c9301e6e7c03d876be80b415783f99cf50f83ec8.tar.gz
sqlite-c9301e6e7c03d876be80b415783f99cf50f83ec8.zip
Fix the constant propagation optimization so that it does not try to
propagate constant expressions that have affinity. Ticket [82ac75ba0093e5dc] FossilOrigin-Name: 6db1c3498f6bfa01bb460e62b802b63ec4bf43577a17a94e1e2fa0ecc1e64960
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/select.c b/src/select.c
index 420d1f061..4826d65f4 100644
--- a/src/select.c
+++ b/src/select.c
@@ -4203,6 +4203,7 @@ static void findConstInWhere(WhereConst *pConst, Expr *pExpr){
if( pRight->op==TK_COLUMN
&& !ExprHasProperty(pRight, EP_FixedCol)
&& sqlite3ExprIsConstant(pLeft)
+ && sqlite3ExprAffinity(pLeft)==0
&& sqlite3IsBinary(sqlite3ExprCompareCollSeq(pConst->pParse,pExpr))
){
constInsert(pConst, pRight, pLeft);
@@ -4210,6 +4211,7 @@ static void findConstInWhere(WhereConst *pConst, Expr *pExpr){
if( pLeft->op==TK_COLUMN
&& !ExprHasProperty(pLeft, EP_FixedCol)
&& sqlite3ExprIsConstant(pRight)
+ && sqlite3ExprAffinity(pRight)==0
&& sqlite3IsBinary(sqlite3ExprCompareCollSeq(pConst->pParse,pExpr))
){
constInsert(pConst, pLeft, pRight);