Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Detect and report circularly defined views even if the views have the columns defined in the CREATE VIEW statement. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
9ab9c8c6d747647f8ade58c2c4812fc6 |
User & Date: | drh 2015-10-11 20:39:46.984 |
Context
2015-10-12
| ||
04:56 | Change all references to 3.8.12 into 3.9.0. Comment changes only - no changes to code. (check-in: 6f2858f681 user: drh tags: trunk) | |
2015-10-11
| ||
20:39 | Detect and report circularly defined views even if the views have the columns defined in the CREATE VIEW statement. (check-in: 9ab9c8c6d7 user: drh tags: trunk) | |
20:08 | Remove an unreachable branch in the query flattener substitution logic. (check-in: 46ee3453a3 user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 | pTab->zName); pFrom->pTab = 0; return WRC_Abort; } pTab->nRef++; #if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE) if( pTab->pSelect || IsVirtual(pTab) ){ if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; assert( pFrom->pSelect==0 ); if( pFrom->fg.isTabFunc && !IsVirtual(pTab) ){ sqlite3ErrorMsg(pParse, "'%s' is not a function", pTab->zName); return WRC_Abort; } pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); sqlite3SelectSetName(pFrom->pSelect, pTab->zName); sqlite3WalkSelect(pWalker, pFrom->pSelect); } #endif } /* Locate the index named by the INDEXED BY clause, if any. */ if( sqlite3IndexedByLookup(pParse, pFrom) ){ return WRC_Abort; | > > > > | 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 | pTab->zName); pFrom->pTab = 0; return WRC_Abort; } pTab->nRef++; #if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE) if( pTab->pSelect || IsVirtual(pTab) ){ i16 nCol; if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; assert( pFrom->pSelect==0 ); if( pFrom->fg.isTabFunc && !IsVirtual(pTab) ){ sqlite3ErrorMsg(pParse, "'%s' is not a function", pTab->zName); return WRC_Abort; } pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); sqlite3SelectSetName(pFrom->pSelect, pTab->zName); nCol = pTab->nCol; pTab->nCol = -1; sqlite3WalkSelect(pWalker, pFrom->pSelect); pTab->nCol = nCol; } #endif } /* Locate the index named by the INDEXED BY clause, if any. */ if( sqlite3IndexedByLookup(pParse, pFrom) ){ return WRC_Abort; |
︙ | ︙ |
Changes to test/view.test.
︙ | ︙ | |||
493 494 495 496 497 498 499 500 501 502 503 504 505 506 | # Ticket #1658 # do_test view-14.1 { catchsql { CREATE TEMP VIEW t1 AS SELECT a,b FROM t1; SELECT * FROM temp.t1; } } {1 {view t1 is circularly defined}} # Tickets #1688, #1709 # do_test view-15.1 { execsql2 { | > > > > > > > | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | # Ticket #1658 # do_test view-14.1 { catchsql { CREATE TEMP VIEW t1 AS SELECT a,b FROM t1; SELECT * FROM temp.t1; } } {1 {view t1 is circularly defined}} do_test view-14.2 { catchsql { DROP VIEW IF EXISTS temp.t1; CREATE TEMP VIEW t1(a,b) AS SELECT a,b FROM t1; SELECT * FROM temp.t1; } } {1 {view t1 is circularly defined}} # Tickets #1688, #1709 # do_test view-15.1 { execsql2 { |
︙ | ︙ |