1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00

Remove the OP_IfNotOpen opcode. The OP_IfNullRow opcode is sufficient to

get the job done.  This is a follow-up to [e71b0465b9fa13db].

FossilOrigin-Name: 797081cb705c65a466379e180344d0c9d781f10415c8ed8f72edc6ea065a1a28
This commit is contained in:
drh
2026-10-08 23:59:13 +00:00
parent bfb858c596
commit 9cba46343e
4 changed files with 17 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
C Ensure\sthe\sjoin\sflags\son\sthe\sparent\sare\sset\scorrectly\swhen\sflattening\sUNION\sALL\ssub-queries\sthat\sinclude\sbranches\swith\sRIGHT\sjoins.\sReport\s[bugs:/info/2026-10-08T15:27:33Z\s|\s2026-10-08T15:27:33Z].
D 2026-10-08T19:34:24.937
C Remove\sthe\sOP_IfNotOpen\sopcode.\s\sThe\sOP_IfNullRow\sopcode\sis\ssufficient\sto\nget\sthe\sjob\sdone.\s\sThis\sis\sa\sfollow-up\sto\s[e71b0465b9fa13db].
D 2026-10-08T23:59:13.467
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -868,7 +868,7 @@ F src/upsert.c dd9f0fcccbfb4f20e1026a21a7254ba3f2c08e9cfa92affaff5b5ec3b00ea549
F src/utf.c c5bec56770b71fe75e12f1f7b0a512032e1fd3d1f83c50c4ab4474ced20347a4
F src/util.c 4437408e09cef6dbb63a8b8ba28be53bdc098ec890e5e64ad7ae1fc83448962e
F src/vacuum.c d3d35d8ae893d419ade5fa196d761a83bddcbb62137a1a157ae751ef38b26e82
F src/vdbe.c 247e0b7d43eeec8727f5446391a633f638df9cd9aaee637b079163ea3a801d42
F src/vdbe.c 2954169319fef68d5119e9855637e7a44dc64f34ee474d68001a05c03072cb48
F src/vdbe.h b6ffb28da04363fd5d439b8204118fd3f2e751abe4f8e3edb089155fb90d4607
F src/vdbeInt.h 68e5ab63f184f2871780c83ce78b425d0360869611baea4c65575f91f76ac1d3
F src/vdbeapi.c 8015628172d959885d5df592b9ddc07c66a803f61f86f1197cc17929c095b2ca
@@ -883,7 +883,7 @@ F src/vxworks.h 9d18819c5235b49c2340a8a4d48195ec5d5afb637b152406de95a9436beeaeab
F src/wal.c 41438914e455bbc42ccff8545eab4c711f91233e480337e44a3d5fdf121fce74
F src/wal.h c6251cfc1950643a976625ca452e46dc9b466b4f5dd2e85f244f29f79bf68ace
F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c f2a92a7bb2b0e2295c1715a1461a7df2b81d2306cbe4698b78df740dd2ae1aef
F src/where.c 7b5b408a0d66ff5b7a071be8352c0920e6dcd9e7846742498460cbf0e2de3f78
F src/whereInt.h f039ad303bc2913de673e431821ef8db3b619d249e6e5548d90072a684e72285
F src/wherecode.c 1a6d2999159b28d8c0b968458b90ec183b3813cb332c11515ab60a73db5c07fd
F src/whereexpr.c 76f72a95c5cf0e8a8edb679ca4fb7afa17ba45ff4effe73c414266510109e701
@@ -2281,8 +2281,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
P 53a73aa03d05350ebee81c3d2aef85744c8ebeda72f565083dc4b472b57c5499
R fe57bd6c375f6e4dbf22be18e69cde3c
U dan
Z 6d721ddda04882419ca5fd3bd8136924
P cfa69ea48a7aa379ee0c30ae81d2802da862d610f829c933e5eb358c23fc2b9d
R 426a085b5ad6bc6a844b020b6fb5e871
U drh
Z ce6a8dfa7f67609ddc2e6787f9d350d0
# Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
cfa69ea48a7aa379ee0c30ae81d2802da862d610f829c933e5eb358c23fc2b9d
797081cb705c65a466379e180344d0c9d781f10415c8ed8f72edc6ea065a1a28

View File

@@ -5381,24 +5381,6 @@ case OP_SeekHit: { /* ncycle */
break;
}
/* Opcode: IfNotOpen P1 P2 * * *
** Synopsis: if( !csr[P1] ) goto P2
**
** If cursor P1 is not open or if P1 is set to a NULL row using the
** OP_NullRow opcode, then jump to instruction P2. Otherwise, fall through.
*/
case OP_IfNotOpen: { /* jump */
VdbeCursor *pCur;
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pCur = p->apCsr[pOp->p1];
VdbeBranchTaken( NEVER(pCur==0) || pCur->nullRow, 2);
if( NEVER(pCur==0) || pCur->nullRow ){
goto jump_to_p2_and_check_for_interrupt;
}
break;
}
/* Opcode: Found P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**

View File

@@ -7645,16 +7645,14 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
(pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
&& (pLoop->wsFlags & WHERE_IN_EARLYOUT)!=0;
if( pLevel->iLeftJoin ){
/* For LEFT JOIN queries, cursor pIn->iCur may not have been
** opened yet. This occurs for WHERE clauses such as
** "a = ? AND b IN (...)", where the index is on (a, b). If
** the RHS of the (a=?) is NULL, then the "b IN (...)" may
** never have been coded, but the body of the loop run to
** return the null-row. So, if the cursor is not open yet,
** jump over the OP_Next or OP_Prev instruction about to
** be coded. */
sqlite3VdbeAddOp2(v, OP_IfNotOpen, pIn->iCur,
sqlite3VdbeCurrentAddr(v) + 2 + bEarlyOut);
/* For LEFT JOIN queries, cursor pIn->iCur might have been
** disabled by OP_NullRow. This occurs for WHERE clauses such
** as "a = ? AND b IN (...)", where the index is on (a, b).
** When the OP_IfNullRow jump is taken, the pIn->iBase register
** is NULLed out as a side effect. But as that register is not
** used when the jump is taken, the side-effect is harmless. */
sqlite3VdbeAddOp3(v, OP_IfNullRow, pIn->iCur,
sqlite3VdbeCurrentAddr(v) + 2 + bEarlyOut, pIn->iBase);
VdbeCoverage(v);
}
if( bEarlyOut ){