Fix bug in the premutation testing that was causing many permutations from
begin skipped. There are now 16 errors reported by the permutation test. (CVS 5610)
FossilOrigin-Name: 4ad096bda1fc5c7b66f71ff5b32a4085c9a40574
diff --git a/src/resolve.c b/src/resolve.c
index b9d5360..439fc74 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -14,7 +14,7 @@
** resolve all identifiers by associating them with a particular
** table and column.
**
-** $Id: resolve.c,v 1.3 2008/08/25 12:14:09 drh Exp $
+** $Id: resolve.c,v 1.4 2008/08/25 17:23:29 drh Exp $
*/
#include "sqliteInt.h"
#include <stdlib.h>
@@ -647,9 +647,7 @@
struct ExprList_item *pItem;
moreToDo = 0;
pEList = pSelect->pEList;
- if( pEList==0 ){
- return 1;
- }
+ assert( pEList!=0 );
for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
int iCol = -1;
Expr *pE, *pDup;
@@ -730,9 +728,7 @@
}
#endif
pEList = pSelect->pEList;
- if( pEList==0 ){
- return 0;
- }
+ assert( pEList!=0 ); /* sqlite3SelectNew() guarantees this */
for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
if( pItem->iCol ){
Expr *pE;
@@ -749,7 +745,7 @@
sqlite3ExprDelete(db, pE);
pE = sqlite3ExprDup(db, pEList->a[pItem->iCol-1].pExpr);
pItem->pExpr = pE;
- if( pE && pColl && flags ){
+ if( pE && flags ){
pE->pColl = pColl;
pE->flags |= flags;
}
@@ -809,7 +805,7 @@
/* The ORDER BY term is an integer constant. Again, set the column
** number so that sqlite3ResolveOrderGroupBy() will convert the
** order-by term to a copy of the result-set expression */
- if( iCol<1 || iCol>nResult ){
+ if( iCol<1 ){
resolveOutOfRangeError(pParse, zType, i+1, nResult);
return 1;
}
@@ -842,7 +838,7 @@
sqlite3 *db; /* Database connection */
- if( p==0 ) return WRC_Continue;
+ assert( p!=0 );
if( p->selFlags & SF_Resolved ){
return WRC_Prune;
}
@@ -890,7 +886,7 @@
/* Resolve names in the result set. */
pEList = p->pEList;
- if( !pEList ) return WRC_Abort;
+ assert( pEList!=0 );
for(i=0; i<pEList->nExpr; i++){
Expr *pX = pEList->a[i].pExpr;
if( sqlite3ResolveExprNames(&sNC, pX) ){
@@ -1102,11 +1098,10 @@
){
Walker w;
- if( p ){
- w.xExprCallback = resolveExprStep;
- w.xSelectCallback = resolveSelectStep;
- w.pParse = pParse;
- w.u.pNC = pOuterNC;
- sqlite3WalkSelect(&w, p);
- }
+ assert( p!=0 );
+ w.xExprCallback = resolveExprStep;
+ w.xSelectCallback = resolveSelectStep;
+ w.pParse = pParse;
+ w.u.pNC = pOuterNC;
+ sqlite3WalkSelect(&w, p);
}