diff options
author | drh <drh@noemail.net> | 2020-01-18 13:53:46 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-01-18 13:53:46 +0000 |
commit | 1ee02a1ce5a471966c3e5cc04af74ed16b1be6ce (patch) | |
tree | f060bed09414a1e814cf9859d80473687402cd06 /src | |
parent | 2d58b7f40f38519b9fdff0f604d19c4b39ae0008 (diff) | |
download | sqlite-1ee02a1ce5a471966c3e5cc04af74ed16b1be6ce.tar.gz sqlite-1ee02a1ce5a471966c3e5cc04af74ed16b1be6ce.zip |
Fix the VDBE so that it correctly handles the sequence of operations
OP_OpenEphemeral, OP_OpenDup, OP_OpenEphemeral, and OP_OpenDup in that
order on the same cursor.
FossilOrigin-Name: a1be6ee0188911448c064e2c25fb0ca1daad50f3d50fb49a34430bd09736b4a9
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbe.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/vdbe.c b/src/vdbe.c index 14c83bd1f..b885f14a5 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -3917,15 +3917,13 @@ case OP_OpenEphemeral: { assert( pOp->p1>=0 ); assert( pOp->p2>=0 ); pCx = p->apCsr[pOp->p1]; - if( pCx ){ + if( pCx && pCx->pBtx ){ /* If the ephermeral table is already open, erase all existing content ** so that the table is empty again, rather than creating a new table. */ assert( pCx->isEphemeral ); pCx->seqCount = 0; pCx->cacheStatus = CACHE_STALE; - if( pCx->pBtx ){ - rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0); - } + rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0); }else{ pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE); if( pCx==0 ) goto no_mem; |