From: drh <> Date: Tue, 21 Apr 2026 12:59:43 +0000 (+0000) Subject: Fix another bug in [/info/e33da6d5dc964db8|EXISTS-to-JOIN] - this one X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=5e99eeb3d88ffb7670ebbcbf62c4cb5cbec28137;p=thirdparty%2Fsqlite.git Fix another bug in [/info/e33da6d5dc964db8|EXISTS-to-JOIN] - this one having to do with an OFFSET clause of a LIMIT. Reported by [forum:/forumpost/2026-04-21T10:57:09Z|forum post 2026-04-21T10:57:09Z]. FossilOrigin-Name: 1dd3c6a5e50ac3f617683678223e42f48636c17e58905506c5c74cc4bf05845c --- diff --git a/manifest b/manifest index 914aa43df2..471a66cd13 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reformulate\show\sthe\sOPFS\sasync\sproxy\sWorker\sis\sloaded\sfor\sthe\sbundler-friendly\sbuilds\sto\swork\saround\sa\sbug\sin\sVite\sin\swhich\sit\sincompatibly\srewrites\sthe\sWorker's\sURL\sarguments.\sAddresses\sthe\sdiscussion\sat\s[https://github.com/sqlite/sqlite-wasm/pull/159|npm\spackage\sPR\s159]\sand\spatch\svalidated\sby\sJure\sRotar. -D 2026-04-21T10:19:38.102 +C Fix\sanother\sbug\sin\s[/info/e33da6d5dc964db8|EXISTS-to-JOIN]\s-\sthis\sone\nhaving\sto\sdo\swith\san\sOFFSET\sclause\sof\sa\sLIMIT.\s\sReported\sby\n[forum:/forumpost/2026-04-21T10:57:09Z|forum\spost\s2026-04-21T10:57:09Z]. +D 2026-04-21T12:59:43.077 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -735,7 +735,7 @@ F src/printf.c 50be92de0725e88c8b38978775ab46f9b42d74e21f65045c3423503173eb0566 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 928ff887f2a7c64275182060d94d06fdddbe32226c569781cf7e7edc6f58d7fd F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c ffe199f025a0dd74670d2a77232bdea364a4d7b36f32c64a6572d39ba6a11576 +F src/select.c 2ef8d7c8d1bf8dfba18bd0264b2777c160e94941638de67a0f2ea9e422bfb390 F src/shell.c.in b399c9a95de754595345bdd98e631c3ba55162c446d70b44398223c25dc4065a F src/sqlite.h.in 39d2e09114d2bdb7afd998f4a469c8f8cd065f8093835a7d0422f260fc78fb4f F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 @@ -1100,7 +1100,7 @@ F test/exclusive.test 7ff63be7503990921838d5c9f77f6e33e68e48ed1a9d48cd28745bf650 F test/exclusive2.test cd70b1d9c6fffd336f9795b711dcc5d9ceba133ad3f7001da3fda63615bdc91e F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7 F test/exists.test 79a75323c78f02bbe9c251ea502a092f9ef63dac -F test/existsexpr.test 75c1c13cda18b53f68c135fe644afc034d72a6de5b0774b0219ca4a6dc4b96b0 +F test/existsexpr.test 630b64d75002d7dc1aab46899073ef7cec57fb0893ec8ab14ff50e882c03b56e F test/existsexpr2.test dc23e76389eff3d29f6488ff733012a3560cd67ec8cfaecbecd52cced5d5af11 F test/existsfault.test ff41c11f3052c1bbd4f8dd557802310026253d67d7c4e3a180c16d2f0862973e F test/expr.test db981f8a85520e99ae20aab7ad2e9b5b0437ed09159b57ced434c672075d2e61 @@ -2202,9 +2202,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P fe0414a9a3caf6af67f53a5f3534efd5d4bf4978ebce1c591ef62d6961e55701 -Q +6215c9dd27ca446bf61d8ee7adcf455d35914853b19cb5f5feff5ce0f420e7b7 -R 55a624a182f8d583a740389ab62a7c54 -U stephan -Z 38cca26b2ca2f0ce38c99a4ddf10f846 +P ec877a30f5c5db30b9154745140744c5cc80d89673d79e50901d7377599cf2b4 +R 6a2eca6fe49e854db509b1bdc80becb2 +U drh +Z 8c310bed772ca80d6df496ba9f9bec7e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index af013493a6..51062b4d6e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ec877a30f5c5db30b9154745140744c5cc80d89673d79e50901d7377599cf2b4 +1dd3c6a5e50ac3f617683678223e42f48636c17e58905506c5c74cc4bf05845c diff --git a/src/select.c b/src/select.c index e8e9f36a88..840d800c98 100644 --- a/src/select.c +++ b/src/select.c @@ -7324,6 +7324,7 @@ static SQLITE_NOINLINE void existsToJoin( && !ExprHasProperty(pWhere, EP_OuterON|EP_InnerON) && ALWAYS(p->pSrc!=0) && p->pSrc->nSrcpLimit==0 || p->pLimit->pRight==0) ){ if( pWhere->op==TK_AND ){ Expr *pRight = pWhere->pRight; diff --git a/test/existsexpr.test b/test/existsexpr.test index 28029359b8..724fa25749 100644 --- a/test/existsexpr.test +++ b/test/existsexpr.test @@ -476,6 +476,29 @@ catch { optimization_control db exists-to-join 0 } db cache flush do_execsql_test 9.6 $Q {{big string value}} +#------------------------------------------------------------------------- +# Forum post 2026-04-21T10:57:09Z +do_execsql_test 9.7.1 { + DROP TABLE t3; + CREATE TABLE t3(x INT, y INT); + CREATE TABLE t4(z INT); + INSERT INTO t3 VALUES (1,0),(2,2),(3,3); + INSERT INTO t4 VALUES (4),(5); +} +set Q { + SELECT x FROM t3 + WHERE EXISTS(SELECT 1 FROM t4 WHERE z>y) + LIMIT 1 OFFSET 1 +} +catch { optimization_control db all 1 } +db cache flush +do_execsql_test 9.7.2 $Q {2} +catch { optimization_control db exists-to-join 0 } +db cache flush +do_execsql_test 9.7.3 $Q {2} +catch { optimization_control db all 1 } +db cache flush + #------------------------------------------------------------------------- reset_db