Fix a problem with sub-queries and the flattening optimization. Also handle an extra case of database corruption. (CVS 2324)
FossilOrigin-Name: f7858d8830cdd0f57b8f9bc73068d29a7062b8ac
diff --git a/src/expr.c b/src/expr.c
index 487c539..f27bed5 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.193 2005/02/08 07:50:41 danielk1977 Exp $
+** $Id: expr.c,v 1.194 2005/02/12 08:59:57 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -473,7 +473,10 @@
pNewItem->zAlias = sqliteStrDup(pOldItem->zAlias);
pNewItem->jointype = pOldItem->jointype;
pNewItem->iCursor = pOldItem->iCursor;
- pNewItem->pTab = 0;
+ pNewItem->pTab = pOldItem->pTab;
+ if( pNewItem->pTab ){
+ pNewItem->pTab->isTransient = 0;
+ }
pNewItem->pSelect = sqlite3SelectDup(pOldItem->pSelect);
pNewItem->pOn = sqlite3ExprDup(pOldItem->pOn);
pNewItem->pUsing = sqlite3IdListDup(pOldItem->pUsing);
@@ -518,8 +521,8 @@
pNew->iOffset = -1;
pNew->ppOpenTemp = 0;
pNew->pFetch = 0;
- pNew->isResolved = 0;
- pNew->isAgg = 0;
+ pNew->isResolved = p->isResolved;
+ pNew->isAgg = p->isAgg;
return pNew;
}
#else