diff options
author | dan <Dan Kennedy> | 2021-05-17 16:20:41 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2021-05-17 16:20:41 +0000 |
commit | be12083bc792b35441f217aec141a3a4b8bd44bf (patch) | |
tree | eda41782ddf9a380ed5b78bbb0df41279a67a4d8 /src/resolve.c | |
parent | ba39ca40588dfef1a07f172c20fac0197c01c0a2 (diff) | |
download | sqlite-be12083bc792b35441f217aec141a3a4b8bd44bf.tar.gz sqlite-be12083bc792b35441f217aec141a3a4b8bd44bf.zip |
Fix problems with refering to CTEs from within sub-selects in PARTITION BY or ORDER BY clauses of window frame definitions. Also a problem with renaming a column when the schema contains a trigger containing a correlated sub-select within a window frames PARTITION BY or ORDER BY clause.
FossilOrigin-Name: 4c6cd54a8db78e5535912e76856bed4f797261aaca4248c69d2e2452194de297
Diffstat (limited to 'src/resolve.c')
-rw-r--r-- | src/resolve.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/resolve.c b/src/resolve.c index 4f5c5b961..d5cec3550 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -1715,6 +1715,19 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } } +#ifndef SQLITE_OMIT_WINDOWFUNC + if( IN_RENAME_OBJECT ){ + Window *pWin; + for(pWin=p->pWinDefn; pWin; pWin=pWin->pNextWin){ + if( sqlite3ResolveExprListNames(&sNC, pWin->pOrderBy) + || sqlite3ResolveExprListNames(&sNC, pWin->pPartition) + ){ + return WRC_Abort; + } + } + } +#endif + /* The ORDER BY and GROUP BY clauses may not refer to terms in ** outer queries */ @@ -1771,19 +1784,6 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } } -#ifndef SQLITE_OMIT_WINDOWFUNC - if( IN_RENAME_OBJECT ){ - Window *pWin; - for(pWin=p->pWinDefn; pWin; pWin=pWin->pNextWin){ - if( sqlite3ResolveExprListNames(&sNC, pWin->pOrderBy) - || sqlite3ResolveExprListNames(&sNC, pWin->pPartition) - ){ - return WRC_Abort; - } - } - } -#endif - /* If this is part of a compound SELECT, check that it has the right ** number of expressions in the select list. */ if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){ |