diff options
Diffstat (limited to 'lib/libsqlite3/src/resolve.c')
-rw-r--r-- | lib/libsqlite3/src/resolve.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libsqlite3/src/resolve.c b/lib/libsqlite3/src/resolve.c index 3da48136fdf..090fa79842f 100644 --- a/lib/libsqlite3/src/resolve.c +++ b/lib/libsqlite3/src/resolve.c @@ -533,7 +533,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ nId = sqlite3Strlen30(zId); pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0); if( pDef==0 ){ - pDef = sqlite3FindFunction(pParse->db, zId, nId, -1, enc, 0); + pDef = sqlite3FindFunction(pParse->db, zId, nId, -2, enc, 0); if( pDef==0 ){ no_such_func = 1; }else{ @@ -883,7 +883,7 @@ static int resolveOrderGroupBy( ExprList *pOrderBy, /* An ORDER BY or GROUP BY clause to resolve */ const char *zType /* Either "ORDER" or "GROUP", as appropriate */ ){ - int i; /* Loop counter */ + int i, j; /* Loop counters */ int iCol; /* Column number */ struct ExprList_item *pItem; /* A term of the ORDER BY clause */ Parse *pParse; /* Parsing context */ @@ -920,6 +920,11 @@ static int resolveOrderGroupBy( if( sqlite3ResolveExprNames(pNC, pE) ){ return 1; } + for(j=0; j<pSelect->pEList->nExpr; j++){ + if( sqlite3ExprCompare(pE, pSelect->pEList->a[j].pExpr)==0 ){ + pItem->iOrderByCol = j+1; + } + } } return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); } |