diff options
author | drh <> | 2021-06-22 23:24:58 +0000 |
---|---|---|
committer | drh <> | 2021-06-22 23:24:58 +0000 |
commit | 415ac68ae8a5c6c9a8806cc34b01101ca0891bd3 (patch) | |
tree | 7bf99c180c7bb5245d643ed40ce13c072c0f8cdf /src | |
parent | 2c7188732d7c62a0b04bc972c3b161442e693e28 (diff) | |
download | sqlite-415ac68ae8a5c6c9a8806cc34b01101ca0891bd3.tar.gz sqlite-415ac68ae8a5c6c9a8806cc34b01101ca0891bd3.zip |
When an index is used by all branches of the WHERE_MULTI_OR optimization and
becomes a covering index, make sure the index has been created prior to
NULLing it in the OP_NullRow opcode of a LEFT JOIN. See
[forum:/forumpost/0575376e07|forum post 0575376e07]. The covering-index for
WHERE_MULTI_OR optimization was added by [62678be3df35cdcb]. Test cases are
in the orindex01.test module of TH3.
FossilOrigin-Name: 787c76a865dc51dbca4f30432d64783199c2efb1df4619e4bbaf32182977321e
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/where.c b/src/where.c index 5315520db..467963fda 100644 --- a/src/where.c +++ b/src/where.c @@ -5528,6 +5528,12 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ if( (ws & WHERE_INDEXED) || ((ws & WHERE_MULTI_OR) && pLevel->u.pCovidx) ){ + if( ws & WHERE_MULTI_OR ){ + Index *pIx = pLevel->u.pCovidx; + int iDb = sqlite3SchemaToIndex(db, pIx->pSchema); + sqlite3VdbeAddOp3(v, OP_ReopenIdx, pLevel->iIdxCur, pIx->tnum, iDb); + sqlite3VdbeSetP4KeyInfo(pParse, pIx); + } sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur); } if( pLevel->op==OP_Return ){ |