diff --git a/manifest b/manifest index 539aa8cb55..618e2ae14f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\ssqlite3SrcListAppendList()\sroutine\sso\sthat\sit\scorrectly\sadds\nthe\sJT_LTORJ\sattribute\sto\sthe\sfirst\sSrcItem,\sif\sneeded. -D 2022-04-18T10:09:29.854 +C Do\snot\sallow\san\sempty\stable\sbypass\sto\sjump\soutside\sof\sa\sright-join\sbody\nsubroutine. +D 2022-04-18T10:26:50.482 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -641,7 +641,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b F src/where.c 45102d682f6efd450d89c0c5f09b838be6d69c84c6105336730ee38d3b452fad F src/whereInt.h eecce79edc6f7005f91f35be6b18b7053f794e1b50e95bcd06a2d537fc176734 -F src/wherecode.c cb747d628e8fdc0396529c07be9c772c2978016a723eba9c3329f8ef5e4411f1 +F src/wherecode.c 4e03f17f8e7b89b9f85d14d705944acf0b0adff3de47753bdd99cf98b0142997 F src/whereexpr.c 174d4ad5be165c610c907abb779ef4a97974d22b84e1ce7898d2d9f6947249e5 F src/window.c 42a71595263dbd8ef8248218e4fc7d4b5ddccece52146ad48e079342d93f6f8f F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 @@ -1147,7 +1147,7 @@ F test/join4.test 1a352e4e267114444c29266ce79e941af5885916 F test/join5.test c4df54e2e204d7f1417bfbdd21ca324b4b07415c647595cc47798eacfddc96d3 F test/join6.test f809c025fa253f9e150c0e9afd4cef8813257bceeb6f46e04041228c9403cc2c F test/join7.test e5c9b1b729d7e1d0b4195e99833e0ff0cf2d88e7fdd32b49af1044f4c76f72d9 -F test/join8.test 4f085a233582724be035e83100f458c4cfdd8101699c27feac2782242c037682 +F test/join8.test 8a4cea60cc57ad95f0c718f460d86a7a239fbb50eaf2fa37b66d5f195f40220c F test/join9.test afd899f0bda3db6d5fefae2275ad91802d056c7dcd109030100b87e0b75f47ff F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497 F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4 @@ -1948,8 +1948,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0ccb224e13ad44c7e1a3aa186821a929faabc0075fe15799476c00d9a92e9d91 -R 868a3abe5b71496a81ccd2968e4bc123 +P 07ed0dca310d828f9fe152efa8ee2a89202771a8f661afa1dbeee34aaabef67a +R a87b222d27880866b7dfd28f3fc0e49d U drh -Z 4d37f6a11fcac66c4ed7fb866c6b8bbc +Z 6dba88c851bb0b27e425f682c55f1888 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b6fbaa25a3..176d66942a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -07ed0dca310d828f9fe152efa8ee2a89202771a8f661afa1dbeee34aaabef67a \ No newline at end of file +1549dcd2353903b70abadd428eeef971ab940df04fb05a6b83b04ee30932db6d \ No newline at end of file diff --git a/src/wherecode.c b/src/wherecode.c index f08a4c2806..e4a7b449f1 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1516,7 +1516,10 @@ Bitmask sqlite3WhereCodeOneLoopStart( /* Compute a safe address to jump to if we discover that the table for ** this loop is empty and can never contribute content. */ - for(j=iLevel; j>0 && pWInfo->a[j].iLeftJoin==0; j--){} + for(j=iLevel; j>0; j--){ + if( pWInfo->a[j].iLeftJoin ) break; + if( pWInfo->a[j].pRJ ) break; + } addrHalt = pWInfo->a[j].addrBrk; /* Special case of a FROM clause subquery implemented as a co-routine */ diff --git a/test/join8.test b/test/join8.test index 0317722fd0..c99b0f8c64 100644 --- a/test/join8.test +++ b/test/join8.test @@ -35,20 +35,22 @@ do_execsql_test join8-10 { # do_test join8-issue-1 {set rc "Issue-1 'row-value subroutine' unresolved"} {} -# Pending issue #2: +# Pending issue #2: (now resolved) # Jump to addrHalt inside the RIGHT JOIN body subroutine bypasses the # OP_Return, resulting in a subroutine loop. Test case: # -# CREATE TABLE t1(a int, b int, c int); -# INSERT INTO t1 VALUES(1,2,3),(4,5,6); -# CREATE TABLE t2(d int, e int); -# INSERT INTO t2 VALUES(3,333),(4,444); -# CREATE TABLE t3(f int, g int); -# PRAGMA automatic_index=off; -# .eqp trace -# SELECT * FROM t1 RIGHT JOIN t2 ON c=d JOIN t3 ON f=e; -# -do_test join8-issue-2 {set rc "Issue-2 'jump to addrHalt' unresolved"} {} +reset_db +do_execsql_test join8-2000 { + CREATE TABLE t1(a int, b int, c int); + INSERT INTO t1 VALUES(1,2,3),(4,5,6); + CREATE TABLE t2(d int, e int); + INSERT INTO t2 VALUES(3,333),(4,444); + CREATE TABLE t3(f int, g int); + PRAGMA automatic_index=off; +} {} +do_catchsql_test join8-2010 { + SELECT * FROM t1 RIGHT JOIN t2 ON c=d JOIN t3 ON f=e; +} {0 {}} # Demonstrate that nested FULL JOINs and USING clauses work #