1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Disable the reuse of IN-clause subqueries if the subquery is an explicit

"SELECT ALL".  The ALL keyword is almost never used in actual practice (most
developers don't even know it can be used) so this should not interfere with
the optimization, but it does give us a convenient way to turn it off for
testing purposes.

FossilOrigin-Name: a81299be2ce203dcc28e7d0ba24791cbfba80e1ee3e1564469a226cac8adb17d
This commit is contained in:
drh
2024-07-04 18:26:41 +00:00
parent 6c23f1941b
commit 42305fc126
3 changed files with 13 additions and 13 deletions

View File

@@ -3439,6 +3439,8 @@ static int findCompatibleInRhsSubrtn(
assert( pExpr->op==TK_IN );
assert( !ExprUseYSub(pExpr) );
assert( ExprUseXSelect(pExpr) );
assert( pExpr->x.pSelect!=0 );
assert( (pExpr->x.pSelect->selFlags & SF_All)==0 );
v = pParse->pVdbe;
assert( v!=0 );
pOp = sqlite3VdbeGetOp(v, 1);
@@ -3514,11 +3516,9 @@ void sqlite3CodeRhsOfIN(
** Compute a signature for the RHS of the IN operator to facility
** finding and reusing prior instances of the same IN operator.
*/
SubrtnSig *pSig;
if( !ExprUseXSelect(pExpr) ){
pSig = 0;
}else{
assert( pExpr->x.pSelect!=0 );
SubrtnSig *pSig = 0;
assert( !ExprUseXSelect(pExpr) || pExpr->x.pSelect!=0 );
if( ExprUseXSelect(pExpr) && (pExpr->x.pSelect->selFlags & SF_All)==0 ){
pSig = sqlite3DbMallocRawNN(pParse->db, sizeof(pSig[0]));
if( pSig ){
pSig->selId = pExpr->x.pSelect->selId;