1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Detect any attempt to use an INDEXED BY clause on a CTE and report an

error.

FossilOrigin-Name: 35a9de2c97b9a386070e7827a0842bb1caf3af69ea0d6f67ce2a50be3426fb63
This commit is contained in:
drh
2021-10-09 16:00:56 +00:00
parent b18b3df1da
commit 0c1da68907
3 changed files with 11 additions and 8 deletions

View File

@@ -5253,7 +5253,10 @@ static int resolveFromTermToCte(
if( db->mallocFailed ) return 2;
pFrom->pSelect->selFlags |= SF_CopyCte;
assert( pFrom->pSelect );
assert( pFrom->fg.isIndexedBy==0 ); /* Prevent collision in union u2 */
if( pFrom->fg.isIndexedBy ){
sqlite3ErrorMsg(pParse, "no such index: \"%s\"", pFrom->u1.zIndexedBy);
return 2;
}
pFrom->fg.isCte = 1;
pFrom->u2.pCteUse = pCteUse;
pCteUse->nUse++;