aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2014-01-15 14:17:31 +0000
committerdan <dan@noemail.net>2014-01-15 14:17:31 +0000
commitbfe31e7f80a97601c4d68e9dbc359493669ab7e8 (patch)
treeca359f5b51382a0c035ba3177599669b072fba4b /src/expr.c
parentf9db522fee74370e6994fe2c323da2412a097cf9 (diff)
downloadsqlite-bfe31e7f80a97601c4d68e9dbc359493669ab7e8.tar.gz
sqlite-bfe31e7f80a97601c4d68e9dbc359493669ab7e8.zip
Disable the flattening optimization if the sub-query is a recursive CTE.
FossilOrigin-Name: 9472f6d820a7fb233936d9b8f7a39c9d4c4d6d73
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c
index e271e4679..4da9d6263 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -895,7 +895,12 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int flags, u8 **pzBuffer){
return pNew;
}
-With *withDup(sqlite3 *db, With *p){
+/*
+** Create and return a deep copy of the object passed as the second
+** argument. If an OOM condition is encountered, NULL is returned
+** and the db->mallocFailed flag set.
+*/
+static With *withDup(sqlite3 *db, With *p){
With *pRet = 0;
if( p ){
int nByte = sizeof(*p) + sizeof(p->a[0]) * (p->nCte-1);
@@ -1055,7 +1060,8 @@ Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){
pNew->addrOpenEphm[1] = -1;
pNew->addrOpenEphm[2] = -1;
pNew->pWith = withDup(db, p->pWith);
- pNew->pRecurse = p->pRecurse;
+ assert( p->pRecurse==0 );
+ pNew->pRecurse = 0;
return pNew;
}
#else