mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Enable the EXISTS-to-JOIN optimization if the outer query has no
FROM clause. FossilOrigin-Name: 1b9b124f9a35ebd1ac4ea70ef1ee08a4c82c11da690d4164f6b785a6fd9730d9
This commit is contained in:
@@ -5138,6 +5138,9 @@ void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){
|
||||
*/
|
||||
SrcList *sqlite3SrcListAppendList(Parse *pParse, SrcList *p1, SrcList *p2){
|
||||
assert( p1 );
|
||||
assert( p2 || pParse->nErr );
|
||||
assert( p2==0 || p2->nSrc>=1 );
|
||||
testcase( p1->nSrc==0 );
|
||||
if( p2 ){
|
||||
int nOld = p1->nSrc;
|
||||
SrcList *pNew = sqlite3SrcListEnlarge(pParse, p1, p2->nSrc, nOld);
|
||||
@@ -5146,10 +5149,10 @@ SrcList *sqlite3SrcListAppendList(Parse *pParse, SrcList *p1, SrcList *p2){
|
||||
}else{
|
||||
p1 = pNew;
|
||||
memcpy(&p1->a[nOld], p2->a, p2->nSrc*sizeof(SrcItem));
|
||||
assert( nOld==1 || (p2->nSrc==1 && (p2->a[0].fg.jointype&JT_LTORJ)==0) );
|
||||
assert( p1->nSrc>=2 );
|
||||
assert( nOld==1 || (p2->a[0].fg.jointype & JT_LTORJ)==0 );
|
||||
assert( p1->nSrc>=1 );
|
||||
p1->a[0].fg.jointype |= (JT_LTORJ & p2->a[0].fg.jointype);
|
||||
sqlite3DbFree(pParse->db, p2);
|
||||
p1->a[0].fg.jointype |= (JT_LTORJ & p1->a[1].fg.jointype);
|
||||
}
|
||||
}
|
||||
return p1;
|
||||
|
@@ -7432,7 +7432,6 @@ static SQLITE_NOINLINE void existsToJoin(
|
||||
){
|
||||
if( pWhere
|
||||
&& !ExprHasProperty(pWhere, EP_OuterON|EP_InnerON)
|
||||
&& p->pSrc->nSrc>0
|
||||
&& p->pSrc->nSrc<BMS
|
||||
&& pParse->db->mallocFailed==0
|
||||
){
|
||||
|
Reference in New Issue
Block a user