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

Replace [0f0959c6f95046e8] with a new and better solution that also fixes the

CTE name resolution problem described in
[forum:/forumpost/8590e3f6dc|forum post 8590e3f6dc].
Test cases for both problems added.

FossilOrigin-Name: 5614279daff5007d6e047c5c1b3cc82ba80a5c91c529525b0fe68b79ee82dd2c
This commit is contained in:
drh
2021-05-20 00:44:04 +00:00
parent 5da5b71435
commit cd1499f47b
9 changed files with 74 additions and 26 deletions

View File

@@ -5071,6 +5071,14 @@ static int resolveFromTermToCte(
** it cannot possibly be a CTE reference. */
return 0;
}
if( pFrom->fg.notCte ){
/* The FROM term is specifically excluded from matching a CTE.
** (1) It is part of a trigger that used to have zDatabase but had
** zDatabase removed by sqlite3FixTriggerStep().
** (2) This is the first term in the FROM clause of an UPDATE.
*/
return 0;
}
pCte = searchWith(pParse->pWith, pFrom, &pWith);
if( pCte ){
sqlite3 *db = pParse->db;