Index: src/build.c ================================================================== --- src/build.c +++ src/build.c @@ -429,11 +429,11 @@ pParse->checkSchema = 1; }else if( IsVirtual(p) && pParse->disableVtab ){ p = 0; } - if( p==0 && pParse->nErr==0 ){ + if( p==0 && (!IsReuseSchema(db) || pParse->nErr==0) ){ const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table"; if( zDbase ){ sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); }else{ sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); Index: test/with3.test ================================================================== --- test/with3.test +++ test/with3.test @@ -28,11 +28,11 @@ WITH i(x) AS ( WITH j AS (SELECT 10) SELECT 5 FROM t0 UNION SELECT 8 FROM m ) SELECT * FROM i; -} {1 {no such table: t0}} +} {1 {no such table: m}} # Additional test cases that came out of the work to # fix for Kostya's problem. # do_execsql_test 2.0 {