diff options
author | drh <drh@noemail.net> | 2011-12-10 23:18:32 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-12-10 23:18:32 +0000 |
commit | 4b3ac73c2ff20a5491b9e116502403b5657afeb1 (patch) | |
tree | 55a1d6bd8d87d0f39168bcedb4cd46c0a61caca5 /src/resolve.c | |
parent | 1acc6cbe0078c40dd54d73800d874487b49a6dc5 (diff) | |
download | sqlite-4b3ac73c2ff20a5491b9e116502403b5657afeb1.tar.gz sqlite-4b3ac73c2ff20a5491b9e116502403b5657afeb1.zip |
Minor cleanups of the compound-subquery flattening logic. New test cases
added for joins the compound subquery.
FossilOrigin-Name: 5061d85ff934db3c217c97acbbbed3286d9e02aa
Diffstat (limited to 'src/resolve.c')
-rw-r--r-- | src/resolve.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/resolve.c b/src/resolve.c index 6d857f007..3da48136f 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -799,7 +799,7 @@ static int resolveCompoundOrderBy( pE->pColl = pColl; pE->flags |= EP_IntValue | flags; pE->u.iValue = iCol; - pItem->iCol = (u16)iCol; + pItem->iOrderByCol = (u16)iCol; pItem->done = 1; }else{ moreToDo = 1; @@ -848,12 +848,12 @@ int sqlite3ResolveOrderGroupBy( pEList = pSelect->pEList; assert( pEList!=0 ); /* sqlite3SelectNew() guarantees this */ for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){ - if( pItem->iCol ){ - if( pItem->iCol>pEList->nExpr ){ + if( pItem->iOrderByCol ){ + if( pItem->iOrderByCol>pEList->nExpr ){ resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr); return 1; } - resolveAlias(pParse, pEList, pItem->iCol-1, pItem->pExpr, zType); + resolveAlias(pParse, pEList, pItem->iOrderByCol-1, pItem->pExpr, zType); } } return 0; @@ -900,7 +900,7 @@ static int resolveOrderGroupBy( ** a copy of the iCol-th result-set column. The subsequent call to ** sqlite3ResolveOrderGroupBy() will convert the expression to a ** copy of the iCol-th result-set expression. */ - pItem->iCol = (u16)iCol; + pItem->iOrderByCol = (u16)iCol; continue; } if( sqlite3ExprIsInteger(pE, &iCol) ){ @@ -911,12 +911,12 @@ static int resolveOrderGroupBy( resolveOutOfRangeError(pParse, zType, i+1, nResult); return 1; } - pItem->iCol = (u16)iCol; + pItem->iOrderByCol = (u16)iCol; continue; } /* Otherwise, treat the ORDER BY term as an ordinary expression */ - pItem->iCol = 0; + pItem->iOrderByCol = 0; if( sqlite3ResolveExprNames(pNC, pE) ){ return 1; } |