aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <dan@noemail.net>2020-05-11 10:55:24 +0000
committerdan <dan@noemail.net>2020-05-11 10:55:24 +0000
commitefa78884a8f0049b73e581c7cc93d3070ab1a453 (patch)
treec20a8a613bfd4c721347c0ef6dcae350586798b7 /src
parent9e5fdc41c1f46f92776ede52359900b41b2e3a82 (diff)
downloadsqlite-efa78884a8f0049b73e581c7cc93d3070ab1a453.tar.gz
sqlite-efa78884a8f0049b73e581c7cc93d3070ab1a453.zip
Fix a problem handling constant integer expressions with collation sequences in PARTITION BY clauses.
FossilOrigin-Name: 155e6649efe8614718be7ac6c3cccf5b073ae57496dc220db5e4313621f5188e
Diffstat (limited to 'src')
-rw-r--r--src/window.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/window.c b/src/window.c
index db495d832..f168cf55b 100644
--- a/src/window.c
+++ b/src/window.c
@@ -895,13 +895,19 @@ static ExprList *exprListAppendList(
int i;
int nInit = pList ? pList->nExpr : 0;
for(i=0; i<pAppend->nExpr; i++){
- int iDummy;
Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);
assert( pDup==0 || !ExprHasProperty(pDup, EP_MemToken) );
- if( bIntToNull && pDup && sqlite3ExprIsInteger(pDup, &iDummy) ){
- pDup->op = TK_NULL;
- pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);
- pDup->u.zToken = 0;
+ if( bIntToNull && pDup ){
+ int iDummy;
+ Expr *pSub;
+ for(pSub=pDup; ExprHasProperty(pSub, EP_Skip); pSub=pSub->pLeft){
+ assert( pSub );
+ }
+ if( sqlite3ExprIsInteger(pSub, &iDummy) ){
+ pSub->op = TK_NULL;
+ pSub->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);
+ pSub->u.zToken = 0;
+ }
}
pList = sqlite3ExprListAppend(pParse, pList, pDup);
if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;