Fix for tickets #3378 and #3381 that preserves the aliasing optimization.
And yet, this fix feels uncomfortable. Seeking an alternative... (CVS 5712)
FossilOrigin-Name: f8b759f1977915c314be874840ebf18e6bc69b57
diff --git a/src/expr.c b/src/expr.c
index 3d742cd..ab0cf1e 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.393 2008/09/16 18:02:47 drh Exp $
+** $Id: expr.c,v 1.394 2008/09/17 00:13:12 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -2456,7 +2456,7 @@
Parse *pParse, /* Parsing context */
ExprList *pList, /* The expression list to be coded */
int target, /* Where to write results */
- int doHardCopy /* Call sqlite3ExprHardCopy on each element if true */
+ int doHardCopy /* Make a hard copy of every element */
){
struct ExprList_item *pItem;
int i, n;
@@ -2464,17 +2464,16 @@
assert( target>0 );
n = pList->nExpr;
for(pItem=pList->a, i=0; i<n; i++, pItem++){
-#if 0 /* Remove temporarily for tickets #3378 and #3381 */
if( pItem->iAlias ){
int iReg = codeAlias(pParse, pItem->iAlias, pItem->pExpr);
Vdbe *v = sqlite3GetVdbe(pParse);
sqlite3VdbeAddOp2(v, OP_SCopy, iReg, target+i);
- }else
-#endif
- {
+ }else{
sqlite3ExprCode(pParse, pItem->pExpr, target+i);
}
- if( doHardCopy ) sqlite3ExprHardCopy(pParse, target, n);
+ if( doHardCopy ){
+ sqlite3ExprHardCopy(pParse, target, n);
+ }
}
return n;
}