diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/expr.c | 4 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c index 636cbd0fe..d012c3d5e 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3436,6 +3436,7 @@ static int findCompatibleInRhsSubrtn( Vdbe *v; if( pNewSig==0 ) return 0; + if( pParse->bHasSubrtn==0 ) return 0; assert( pExpr->op==TK_IN ); assert( !ExprUseYSub(pExpr) ); assert( ExprUseXSelect(pExpr) ); @@ -3446,8 +3447,8 @@ static int findCompatibleInRhsSubrtn( pOp = sqlite3VdbeGetOp(v, 1); pEnd = sqlite3VdbeGetLastOp(v); for(; pOp<pEnd; pOp++){ - if( pOp->opcode!=OP_BeginSubrtn ) continue; if( pOp->p4type!=P4_SUBRTNSIG ) continue; + assert( pOp->opcode==OP_BeginSubrtn ); pSig = pOp->p4.pSubrtnSig; assert( pSig!=0 ); if( pNewSig->selId!=pSig->selId ) continue; @@ -3563,6 +3564,7 @@ void sqlite3CodeRhsOfIN( pSig->regReturn = pExpr->y.sub.regReturn; pSig->iTable = iTab; sqlite3VdbeChangeP4(v, -1, (const char*)pSig, P4_SUBRTNSIG); + pParse->bHasSubrtn = 1; } addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index df6774aef..323a257f6 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3834,6 +3834,7 @@ struct Parse { u8 prepFlags; /* SQLITE_PREPARE_* flags */ u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */ u8 bHasWith; /* True if statement contains WITH */ + u8 bHasSubrtn; /* True if any P4_SUBRTNSIG has been set */ #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */ #endif |