aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <>2022-05-02 11:24:21 +0000
committerdrh <>2022-05-02 11:24:21 +0000
commitb94182bdc6235ce520322890d4b1567e6404d04f (patch)
tree6b3fc7a1b171e1c4e4d6584c92dd92e8b2321792 /src/expr.c
parentbae50d6719bd1a748ef3d826b96c38dc47c6d1df (diff)
downloadsqlite-b94182bdc6235ce520322890d4b1567e6404d04f.tar.gz
sqlite-b94182bdc6235ce520322890d4b1567e6404d04f.zip
Bring the comments on sqlite3FindInIndex() into closer alignment with what
that routine actually does. FossilOrigin-Name: 40f3274745b53bb72933c1052d0e85bc74be56d3a1068e9d54dc28763a2cfef9
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c
index 13bacb90c..f8ee68dc2 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -2659,7 +2659,7 @@ static int sqlite3InRhsIsConstant(Expr *pIn){
** all members of the RHS set, skipping duplicates.
**
** A cursor is opened on the b-tree object that is the RHS of the IN operator
-** and pX->iTable is set to the index of that cursor.
+** and the *piTab parameter is set to the index of that cursor.
**
** The returned value of this function indicates the b-tree type, as follows:
**
@@ -2679,7 +2679,10 @@ static int sqlite3InRhsIsConstant(Expr *pIn){
** If the RHS of the IN operator is a list or a more complex subquery, then
** an ephemeral table might need to be generated from the RHS and then
** pX->iTable made to point to the ephemeral table instead of an
-** existing table.
+** existing table. In this case, the creation and initialization of the
+** ephmeral table might be put inside of a subroutine, the EP_Subrtn flag
+** will be set on pX and the pX->y.sub fields will be set to show where
+** the subroutine is coded.
**
** The inFlags parameter must contain, at a minimum, one of the bits
** IN_INDEX_MEMBERSHIP or IN_INDEX_LOOP but not both. If inFlags contains
@@ -2911,6 +2914,8 @@ int sqlite3FindInIndex(
&& ExprUseXList(pX)
&& (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2)
){
+ pParse->nTab--; /* Back out the allocation of the unused cursor */
+ iTab = -1; /* Cursor is not allocated */
eType = IN_INDEX_NOOP;
}