In the LIKE optimization, do not analyze the new virtual WHERE clause terms

until both have been added, since they are expected to be consecutive and
the analysis might add complementary terms.
This fixes a problem caused by [44200596aa943963] and discovered by dbsqlfuzz
and recorded as case 7e3b5983727d843b910b2d9ab556e4afcd777cfb.

FossilOrigin-Name: d35de3ad3fac6b30d3f266cbe4b1e9923eb31a1eff4a869205bbc3ba122eeec5
This commit is contained in:
drh
2023-02-13 12:46:22 +00:00
parent 0c55b5fd1c
commit 9e463e878d
3 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -1,5 +1,5 @@
C Change\sa\svariable\sfrom\s32\sto\s64-bits\sto\savoid\sa\sharmless\scompiler\swarning\nin\sXcode.\s\s[forum:/forumpost/402d733c22|Forum\spost\s402d733c22].
D 2023-02-11T21:11:39.733
C In\sthe\sLIKE\soptimization,\sdo\snot\sanalyze\sthe\snew\svirtual\sWHERE\sclause\sterms\nuntil\sboth\shave\sbeen\sadded,\ssince\sthey\sare\sexpected\sto\sbe\sconsecutive\sand\nthe\sanalysis\smight\sadd\scomplementary\sterms.\nThis\sfixes\sa\sproblem\scaused\sby\s[44200596aa943963]\sand\sdiscovered\sby\sdbsqlfuzz\nand\srecorded\sas\scase\s7e3b5983727d843b910b2d9ab556e4afcd777cfb.
D 2023-02-13T12:46:22.331
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -709,7 +709,7 @@ F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
F src/where.c 5b20d08699c9a55c0556661ff6f937dd1c8e27567b7553e48d477d3fad22ec4c
F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c
F src/wherecode.c 76bca3379219880d2527493b71a3be49e696f75396d3481e4de5d4ceec7886b2
F src/whereexpr.c aa9467272033315424c76f446ca0b65683d6002ededaa65b6a6d4c00b3b525b8
F src/whereexpr.c bbf7259c6c53c728b505eae6c4965c7c0b1abb853aadcc7cbbf4f2d1b38d6b6b
F src/window.c 76a27cff9ea2ded0c2c3527187029259440fabcc4cc4c07b11d942c78494a614
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
@@ -2045,8 +2045,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 44200596aa943963bc6ca98b5d4fd5b9235d1109d8dfc1a75eeae353b4239142
R 903a02fdade5e55a6ea70a4f3fe0e724
P 0216ce23cf23bc147c5de6de178a6689b7ad744bf0ee0098809938b5fe10708b
R 09e9d8286e23e9b338083a6379ec9988
U drh
Z 17dea032ba0170dfca46315f56d7ffa6
Z 7381f85d2ea8678673eb457bc621469f
# Remove this line to create a well-formed Fossil manifest.
+1 -1
View File
@@ -1 +1 @@
0216ce23cf23bc147c5de6de178a6689b7ad744bf0ee0098809938b5fe10708b
d35de3ad3fac6b30d3f266cbe4b1e9923eb31a1eff4a869205bbc3ba122eeec5
+1 -1
View File
@@ -1376,7 +1376,6 @@ static void exprAnalyze(
transferJoinMarkings(pNewExpr1, pExpr);
idxNew1 = whereClauseInsert(pWC, pNewExpr1, wtFlags);
testcase( idxNew1==0 );
exprAnalyze(pSrc, pWC, idxNew1);
pNewExpr2 = sqlite3ExprDup(db, pLeft, 0);
pNewExpr2 = sqlite3PExpr(pParse, TK_LT,
sqlite3ExprAddCollateString(pParse,pNewExpr2,zCollSeqName),
@@ -1384,6 +1383,7 @@ static void exprAnalyze(
transferJoinMarkings(pNewExpr2, pExpr);
idxNew2 = whereClauseInsert(pWC, pNewExpr2, wtFlags);
testcase( idxNew2==0 );
exprAnalyze(pSrc, pWC, idxNew1);
exprAnalyze(pSrc, pWC, idxNew2);
pTerm = &pWC->a[idxTerm];
if( isComplete ){