Match ORDER BY terms to columns using names in compound queries.  Make sure
this works for subqueries, especially in the right-hand side of an IN
operator. Ticket #2296. (CVS 3842)

FossilOrigin-Name: cfc6f933dc60ca88ae848f7f0c402e820437c2ff
diff --git a/src/expr.c b/src/expr.c
index 934f988..f4237b4 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.283 2007/03/27 13:36:37 drh Exp $
+** $Id: expr.c,v 1.284 2007/04/13 16:06:33 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1420,7 +1420,9 @@
         int iParm = pExpr->iTable +  (((int)affinity)<<16);
         ExprList *pEList;
         assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
-        sqlite3Select(pParse, pExpr->pSelect, SRT_Set, iParm, 0, 0, 0, 0);
+        if( sqlite3Select(pParse, pExpr->pSelect, SRT_Set, iParm, 0, 0, 0, 0) ){
+          return;
+        }
         pEList = pExpr->pSelect->pEList;
         if( pEList && pEList->nExpr>0 ){ 
           keyInfo.aColl[0] = binaryCompareCollSeq(pParse, pExpr->pLeft,
@@ -1491,7 +1493,9 @@
       }
       sqlite3ExprDelete(pSel->pLimit);
       pSel->pLimit = sqlite3Expr(TK_INTEGER, 0, 0, &one);
-      sqlite3Select(pParse, pSel, sop, iMem, 0, 0, 0, 0);
+      if( sqlite3Select(pParse, pSel, sop, iMem, 0, 0, 0, 0) ){
+        return;
+      }
       break;
     }
   }