1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Make sure the affinity and datatype of sub-subqueries are initialized

prior to subqueries as the latter relies on the former.

FossilOrigin-Name: 39b4e6ff9316cc78ea88349091e195b8104d1e9e
This commit is contained in:
drh
2013-04-25 00:57:10 +00:00
parent ed17167e1d
commit aa87f9a68b
8 changed files with 53 additions and 16 deletions

View File

@@ -113,7 +113,9 @@ int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){
/*
** Call sqlite3WalkExpr() for every expression in Select statement p.
** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and
** on the compound select chain, p->pPrior.
** on the compound select chain, p->pPrior. Invoke the xSelectCallback()
** either before or after the walk of expressions and FROM clause, depending
** on whether pWalker->bSelectDepthFirst is false or true, respectively.
**
** Return WRC_Continue under normal conditions. Return WRC_Abort if
** there is an abort request.
@@ -127,14 +129,23 @@ int sqlite3WalkSelect(Walker *pWalker, Select *p){
rc = WRC_Continue;
pWalker->walkerDepth++;
while( p ){
rc = pWalker->xSelectCallback(pWalker, p);
if( rc ) break;
if( !pWalker->bSelectDepthFirst ){
rc = pWalker->xSelectCallback(pWalker, p);
if( rc ) break;
}
if( sqlite3WalkSelectExpr(pWalker, p)
|| sqlite3WalkSelectFrom(pWalker, p)
){
pWalker->walkerDepth--;
return WRC_Abort;
}
if( pWalker->bSelectDepthFirst ){
rc = pWalker->xSelectCallback(pWalker, p);
/* Depth-first search is currently only used for
** selectAddSubqueryTypeInfo() and that routine always returns
** WRC_Continue (0). So the following branch is never taken. */
if( NEVER(rc) ) break;
}
p = p->pPrior;
}
pWalker->walkerDepth--;