aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-01-02 00:45:38 +0000
committerdrh <drh@noemail.net>2020-01-02 00:45:38 +0000
commit36e678bc398e864ec0806cf381408a57d6dcd4c4 (patch)
tree7919811bbc17b6bc8dfb176699ddfb271fdb422b /src/expr.c
parent2a83c100728451558b8b3e07e4d172bf9ef9f7fb (diff)
downloadsqlite-36e678bc398e864ec0806cf381408a57d6dcd4c4.tar.gz
sqlite-36e678bc398e864ec0806cf381408a57d6dcd4c4.zip
The sqlite3WhereEnd() call now unwinds all Expr modifications made by the
sqlite3WhereBegin(). FossilOrigin-Name: 7bfd42f1dc0c94f9bb74516e62fec8e39c20f4749f4e0972f66c2886d3c64f73
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/expr.c b/src/expr.c
index b441b9a4f..1c03cf634 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -2933,8 +2933,6 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
SelectDest dest; /* How to deal with SELECT result */
int nReg; /* Registers to allocate */
Expr *pLimit; /* New limit expression */
- Select *pCopy; /* Copy of pSel */
- int rc; /* return value from subroutine call */
Vdbe *v = pParse->pVdbe;
assert( v!=0 );
@@ -3018,16 +3016,9 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
pSel->pLimit = sqlite3PExpr(pParse, TK_LIMIT, pLimit, 0);
}
pSel->iLimit = 0;
-
- /* pSel might be reused. So generate code using a copy of pSel, so that
- ** if the code generator modifies the underlying structure of the SELECT
- ** (for example in whereIndexExprTrans()) the original in pSel will be
- ** unchanged. */
- pCopy = sqlite3SelectDup(pParse->db, pSel, 0);
- rc = sqlite3Select(pParse, pCopy, &dest);
- sqlite3SelectDelete(pParse->db, pCopy);
- if( rc ) return 0;
-
+ if( sqlite3Select(pParse, pSel, &dest) ){
+ return 0;
+ }
pExpr->iTable = rReg = dest.iSDParm;
ExprSetVVAProperty(pExpr, EP_NoReduce);
if( addrOnce ){