1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix a name resolution issue with CTEs.

FossilOrigin-Name: 4fa8235dd59cd683d6c6c97bfe181a9637be7c054d435323c903b9dbd74aff02
This commit is contained in:
drh
2024-08-20 22:44:40 +00:00
parent bb36d55e63
commit a0651b3707
4 changed files with 22 additions and 12 deletions

View File

@ -5823,9 +5823,10 @@ static int resolveFromTermToCte(
assert( pRecTerm->pPrior!=0 );
for(i=0; i<pSrc->nSrc; i++){
SrcItem *pItem = &pSrc->a[i];
if( ((pItem->fg.fixedSchema==0 && pItem->u4.zDatabase==0)
|| pItem->fg.hadSchema==0)
&& pItem->zName!=0
if( pItem->zName!=0
&& !pItem->fg.hadSchema
&& ALWAYS( !pItem->fg.isSubquery )
&& (pItem->fg.fixedSchema || pItem->u4.zDatabase==0)
&& 0==sqlite3StrICmp(pItem->zName, pCte->zName)
){
pItem->pSTab = pTab;