aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2020-01-09 20:11:29 +0000
committerdan <dan@noemail.net>2020-01-09 20:11:29 +0000
commitfbb6e9ff48fd6ee2e638de451e774328d9a5524b (patch)
tree686f219d3a8c3a292ffe0fefc625b3db9b2aa81d /src/expr.c
parent87969b2a1190584c09f8676e3a17c2acaa99227c (diff)
downloadsqlite-fbb6e9ff48fd6ee2e638de451e774328d9a5524b.tar.gz
sqlite-fbb6e9ff48fd6ee2e638de451e774328d9a5524b.zip
Fix an assert() in window.c that could fail with some obscure SELECT statements that use window functions.
FossilOrigin-Name: 83dc55679a91bf5d1d13706088ce58eed02b9aad1ad0ae237966e78e0d769663
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/expr.c b/src/expr.c
index 4e8703e55..67b5ce7dc 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -5183,8 +5183,9 @@ int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){
}
/*
-** Compare two ExprList objects. Return 0 if they are identical and
-** non-zero if they differ in any way.
+** Compare two ExprList objects. Return 0 if they are identical, 1
+** if they are certainly different, or 2 if it is not possible to
+** determine if they are identical or not.
**
** If any subelement of pB has Expr.iTable==(-1) then it is allowed
** to compare equal to an equivalent element in pA with Expr.iTable==iTab.
@@ -5203,10 +5204,11 @@ int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){
if( pA==0 || pB==0 ) return 1;
if( pA->nExpr!=pB->nExpr ) return 1;
for(i=0; i<pA->nExpr; i++){
+ int res;
Expr *pExprA = pA->a[i].pExpr;
Expr *pExprB = pB->a[i].pExpr;
if( pA->a[i].sortFlags!=pB->a[i].sortFlags ) return 1;
- if( sqlite3ExprCompare(0, pExprA, pExprB, iTab) ) return 1;
+ if( (res = sqlite3ExprCompare(0, pExprA, pExprB, iTab)) ) return res;
}
return 0;
}