From: dan Date: Fri, 17 Jan 2014 11:48:24 +0000 (+0000) Subject: Remove some code from resolve.c that was only required for recursive cte references... X-Git-Tag: version-3.8.3~45^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d4dc5fc60b30abb406d7f5efcf5a1003b3fe300;p=thirdparty%2Fsqlite.git Remove some code from resolve.c that was only required for recursive cte references in sub-queries. Also a stray "finish_test" command in pagerfault.test. FossilOrigin-Name: f68c6c4d36481526a9348244adc571ea282dc9eb --- diff --git a/manifest b/manifest index 4d2bec4250..5d2226d267 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sability\sfor\sthe\sauthorizer\scallback\sto\sdisallow\srecursive\nqueries. -D 2014-01-16T22:40:02.405 +C Remove\ssome\scode\sfrom\sresolve.c\sthat\swas\sonly\srequired\sfor\srecursive\scte\sreferences\sin\ssub-queries.\sAlso\sa\sstray\s"finish_test"\scommand\sin\spagerfault.test. +D 2014-01-17T11:48:24.294 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -217,9 +217,9 @@ F src/pragma.c ed409ce4104cf4d9de6ead40ace70974f124853b F src/prepare.c 677521ab7132615a8a26107a1d1c3132f44ae337 F src/printf.c 85d07756e45d7496d19439dcae3e6e9e0090f269 F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece -F src/resolve.c ae278d8ce037883323f677e78c241f64289f12ec +F src/resolve.c 7eda9097b29fcf3d2b42fdc17d1de672134e09b6 F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0 -F src/select.c fc7499ac90fd4d49782e0a16372d3a5efde2aa3b +F src/select.c 65c13f22edfd6af04829439955c7cf5749ea4e87 F src/shell.c 9f3bc02a658b8f61d2cbe60cfc482f660c1c6c48 F src/sqlite.h.in eed7f7d66a60daaa7b4a597dcd9bad87aad9611b F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e @@ -728,7 +728,7 @@ F test/pager1.test 1acbdb14c5952a72dd43129cabdbf69aaa3ed1fa F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f F test/pager4.test b40ecb4cc7dff957ee7916e41ab21d1ed702a642 -F test/pagerfault.test cee8488a935e42a4a2e241e0317dc2814c997783 +F test/pagerfault.test 7285379906ab2f1108b8e82bbdf2d386cc8ff3ff F test/pagerfault2.test caf4c7facb914fd3b03a17b31ae2b180c8d6ca1f F test/pagerfault3.test 1003fcda009bf48a8e22a516e193b6ef0dd1bbd8 F test/pageropt.test 6b8f6a123a5572c195ad4ae40f2987007923bbd6 @@ -1150,7 +1150,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 090a77d97808b86d1e9f5c63c743a2b159a15f5d -R f01d2088e8545f61e859d9aad946ffb1 -U drh -Z b5ce4714b23c3d6e2db0cb8e18c5a93d +P 9efc120a1548c03f3d8aabbadf1050ff2a119c31 +R 175ad2c9f66168be6fabd0b7fdb44bd2 +U dan +Z 6e3919f2cc39eeea18a32475675bdfc0 diff --git a/manifest.uuid b/manifest.uuid index dfccdb311f..6e22de7d56 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9efc120a1548c03f3d8aabbadf1050ff2a119c31 \ No newline at end of file +f68c6c4d36481526a9348244adc571ea282dc9eb \ No newline at end of file diff --git a/src/resolve.c b/src/resolve.c index 724b8538fa..b0adb86295 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -502,16 +502,6 @@ lookupname_end: if( pExpr->op!=TK_AS ){ sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList); } - -#ifndef SQLITE_OMIT_CTE - /* If this expression reads a column value from a recursive CTE - ** reference, then this is equivalent to reading from the outermost - ** available name-context. */ - if( pMatch && pMatch->isRecursive ){ - while( pNC->pNext ) pNC = pNC->pNext; - } -#endif - /* Increment the nRef value on all name contexts from TopNC up to ** the point where the name matched. */ for(;;){ diff --git a/src/select.c b/src/select.c index 66eb4b3367..dc784b3b10 100644 --- a/src/select.c +++ b/src/select.c @@ -1791,16 +1791,6 @@ static int multiSelect( } #ifndef SQLITE_OMIT_CTE - /* If this is a recursive query, check that there is no ORDER BY or - ** LIMIT clause. Neither of these are supported. */ - assert( p->pOffset==0 || p->pLimit ); - if( (p->selFlags & SF_Recursive) && (p->pOrderBy || p->pLimit) ){ - sqlite3ErrorMsg(pParse, "%s in a recursive query is not allowed", - p->pOrderBy ? "ORDER BY" : "LIMIT" - ); - goto multi_select_end; - } - if( p->selFlags & SF_Recursive ){ SrcList *pSrc = p->pSrc; int nCol = p->pEList->nExpr; @@ -1814,6 +1804,16 @@ static int multiSelect( SelectDest tmp2dest; int i; + /* Check that there is no ORDER BY or LIMIT clause. Neither of these + ** are supported on recursive queries. */ + assert( p->pOffset==0 || p->pLimit ); + if( p->pOrderBy || p->pLimit ){ + sqlite3ErrorMsg(pParse, "%s in a recursive query is not allowed", + p->pOrderBy ? "ORDER BY" : "LIMIT" + ); + goto multi_select_end; + } + if( sqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ){ goto multi_select_end; } @@ -3581,7 +3581,7 @@ static int withExpand( pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ) return WRC_Abort; pTab->nRef = 1; - pTab->zName = sqlite3MPrintf(db, "%s", pCte->zName); + pTab->zName = sqlite3DbStrDup(db, pCte->zName); pTab->iPKey = -1; pTab->nRowEst = 1048576; pTab->tabFlags |= TF_Ephemeral; diff --git a/test/pagerfault.test b/test/pagerfault.test index 1e57c93903..796f531c37 100644 --- a/test/pagerfault.test +++ b/test/pagerfault.test @@ -63,7 +63,6 @@ do_faultsim_test pagerfault-1 -prep { error "Database content appears incorrect" } } -finish_test #------------------------------------------------------------------------- # Test fault-injection while rolling back a hot-journal file with a