From: drh Date: Mon, 31 Dec 2018 20:13:12 +0000 (+0000) Subject: Remove an optimization that can no longer occur, being superceded by the X-Git-Tag: version-3.27.0~224^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d471bcb3964e8ee417dfb45acee824dd77238acc;p=thirdparty%2Fsqlite.git Remove an optimization that can no longer occur, being superceded by the subquery-reuse optimization. Put an assert in place of the optimization to detect if the need for this optimization ever returns. FossilOrigin-Name: 4fcdc7a2939457e51aab37cab168677cd7f464a9a0aff4f8981e864a30828b3b --- diff --git a/manifest b/manifest index edcf41514e..a2a2d2d002 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\senhancements\sand\sbug\sfixes\sfrom\strunk. -D 2018-12-31T18:30:41.155 +C Remove\san\soptimization\sthat\scan\sno\slonger\soccur,\sbeing\ssuperceded\sby\sthe\nsubquery-reuse\soptimization.\s\sPut\san\sassert\sin\splace\sof\sthe\soptimization\nto\sdetect\sif\sthe\sneed\sfor\sthis\soptimization\sever\sreturns. +D 2018-12-31T20:13:12.301 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in d8b254f8bb81bab43c340d70d17dc3babab40fcc8a348c8255881f780a45fee6 @@ -510,7 +510,7 @@ F src/printf.c 0f1177cf1dd4d7827bf64d840768514ec76409abecaca9e8b577dbd065150381 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/resolve.c 72fe8cae7326b979e7258ab4c531956951e1a5f3fe8644c646abaec1b2eb6d95 F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 -F src/select.c 2493d09401fdd3c0b9a8d5b15486876f9167f87ef8013d58be9730f4c83bdb0c +F src/select.c 4b0be1bfd2d8668e2711f877682361e06b412c53ce7a56303f1f6978ec33eca8 F src/shell.c.in 207da30342db0b6fac8b2487abd60b059a5ea80cc9494bd1db76a1dd4aae7cca F src/sqlite.h.in b54cd42d2f3b739a00de540cafe2dcd0de3b8e1748a2db33a68def487e9e602f F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -1795,7 +1795,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0f1b9ff9e1e6f13e03045fcb7d0907227085054f9eb0b0b8471fb26b0094b13a f856676c8438dbf52d299e78f6dd6148d929755dc05cdcabafd17d9a86439435 -R 3d5a1ea78142c180da83ac42547c771a +P 9fb646f29c05bca5f677a2c7c4f45c36bfe0a0c6a88cb7968b4a0459bdd63bb2 +R ec7392f6deec1d23ad92b0971adf7e38 U drh -Z 030784c6ac18d793a85199580bd539ae +Z 4914e9d7733cf56aae5640f097ed4039 diff --git a/manifest.uuid b/manifest.uuid index 6c1dca9c24..ae415af0ab 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9fb646f29c05bca5f677a2c7c4f45c36bfe0a0c6a88cb7968b4a0459bdd63bb2 \ No newline at end of file +4fcdc7a2939457e51aab37cab168677cd7f464a9a0aff4f8981e864a30828b3b \ No newline at end of file diff --git a/src/select.c b/src/select.c index 01906c6698..827eff0062 100644 --- a/src/select.c +++ b/src/select.c @@ -5835,22 +5835,12 @@ int sqlite3Select( pSub = pItem->pSelect; if( pSub==0 ) continue; - /* Sometimes the code for a subquery will be generated more than - ** once, if the subquery is part of the WHERE clause in a LEFT JOIN, - ** for example. In that case, do not regenerate the code to manifest - ** a view or the co-routine to implement a view. The first instance - ** is sufficient, though the subroutine to manifest the view does need - ** to be invoked again. */ - if( pItem->addrFillSub ){ - if( pItem->fg.viaCoroutine==0 ){ - /* The subroutine that manifests the view might be a one-time routine, - ** or it might need to be rerun on each iteration because it - ** encodes a correlated subquery. */ - testcase( sqlite3VdbeGetOp(v, pItem->addrFillSub)->opcode==OP_Once ); - sqlite3VdbeAddOp2(v, OP_Gosub, pItem->regReturn, pItem->addrFillSub); - } - continue; - } + /* The code for a subquery should only be generated once, though it is + ** technically harmless for it to be generated multiple times. The + ** following assert() will detect if something changes to cause + ** the same subquery to be coded multiple times, as a signal to the + ** developers to try to optimize the situation. */ + assert( pItem->addrFillSub==0 ); /* Increment Parse.nHeight by the height of the largest expression ** tree referred to by this, the parent select. The child select