mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Improvements to the view-self-join optimization so that it works on all
VIEWs, not just on Common Table Expressions. FossilOrigin-Name: d2fe370cafa9b11f6c3eb4e1c3be48d9d2610b9d2f9d9ebf9e50267f9079dfc0
This commit is contained in:
@@ -5481,10 +5481,12 @@ static struct SrcList_item *isSelfJoinView(
|
||||
if( pItem->pSelect==0 ) continue;
|
||||
if( pItem->fg.viaCoroutine ) continue;
|
||||
if( pItem->zName==0 ) continue;
|
||||
if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue;
|
||||
assert( pItem->pTab!=0 );
|
||||
assert( pThis->pTab!=0 );
|
||||
if( pItem->pTab->pSchema!=pThis->pTab->pSchema ) continue;
|
||||
if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue;
|
||||
pS1 = pItem->pSelect;
|
||||
if( pThis->pSelect->selId!=pS1->selId ){
|
||||
if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
|
||||
/* The query flattener left two different CTE tables with identical
|
||||
** names in the same FROM clause. */
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user