In sqlite3GenerateIndexKey(), do not attempt to reuse column values from

the previous index if the current index is a partial index as the partial
index test may have corrupted those values.  Ticket [a9efb42811fa41ee]

FossilOrigin-Name: 17e9f65814264de9c35bc5ba94e0a66fbbf1200c00d33ab9a19a0b6f92bc685a
This commit is contained in:
drh 2019-11-02 13:32:50 +00:00
parent 978256f3d8
commit 39b30a7d6b
4 changed files with 29 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Restore\sthe\son-line\s".help"\sfor\sthe\s".explain"\scommand\sin\sthe\sCLI.
D 2019-11-02T00:00:14.956
C In\ssqlite3GenerateIndexKey(),\sdo\snot\sattempt\sto\sreuse\scolumn\svalues\sfrom\nthe\sprevious\sindex\sif\sthe\scurrent\sindex\sis\sa\spartial\sindex\sas\sthe\spartial\nindex\stest\smay\shave\scorrupted\sthose\svalues.\s\sTicket\s[a9efb42811fa41ee]
D 2019-11-02T13:32:50.778
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -477,7 +477,7 @@ F src/ctime.c 1b0724e66f95f33b160b1af85caaf9cceb325d22abf39bd24df4f54a73982251
F src/date.c e1d8ac7102f3f283e63e13867acb0efa33861cf34f0faf4cdbaf9fa7a1eb7041
F src/dbpage.c 135eb3b5e74f9ef74bde5cec2571192c90c86984fa534c88bf4a055076fa19b7
F src/dbstat.c c12833de69cb655751487d2c5a59607e36be1c58ba1f4bd536609909ad47b319
F src/delete.c fbe8a2978a35201624ecaaabdaf83917c101e31cf451a7be0cf06d9049fad54e
F src/delete.c c371a9f3517a4dd6a0b56ebab9588408eddf1eac0277b67b09e030bff99ee1fa
F src/expr.c a02db128337ca28c34fc3574a640f247881bc4d14c1debf5adc3ecf25dd74992
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 92a248ec0fa4ed8ab60c98d9b188ce173aaf218f32e7737ba77deb2a684f9847
@ -1053,7 +1053,7 @@ F test/index2.test f835d5e13ca163bd78c4459ca15fd2e4ed487407
F test/index3.test 51685f39345462b84fcf77eb8537af847fdf438cc96b05c45d6aaca4e473ade0
F test/index4.test ab92e736d5946840236cd61ac3191f91a7856bf6
F test/index5.test 8621491915800ec274609e42e02a97d67e9b13e7
F test/index6.test 4d1dd3cab97fba2ddf30bb70afc82eab35bd6e61788b3ac941e55263f81ef7e9
F test/index6.test f172653b35b20233e59200e8b92a76db61bf7285437bf777b93b306ba26a47e7
F test/index7.test 1d764c0cca45f5a76150b08e127ccc8d52492cfa788b5fafed4be784a351b020
F test/index8.test bc2e3db70e8e62459aaa1bd7e4a9b39664f8f9d7
F test/index9.test 0aa3e509dddf81f93380396e40e9bb386904c1054924ba8fa9bcdfe85a8e7721
@ -1849,7 +1849,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 f0ebea35d9d6b69a7bb4242fb79ff3db4267e429855fa6969f9f52ffee1c7a99
R dd0ad84e2261a2b2882eb0334a888497
P 28b8f1036d569bccce56b4e7042348024b5dd1ffa04850cbeddab1e35c49e5b7
R 4c891fd72579455e0ca4b0344f871148
U drh
Z 9ba7e5973ff9e00cea7e79d70e4ff8aa
Z 0e202d8d694c8e918ce5f60538776752

View File

@ -1 +1 @@
28b8f1036d569bccce56b4e7042348024b5dd1ffa04850cbeddab1e35c49e5b7
17e9f65814264de9c35bc5ba94e0a66fbbf1200c00d33ab9a19a0b6f92bc685a

View File

@ -918,6 +918,8 @@ int sqlite3GenerateIndexKey(
sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel,
SQLITE_JUMPIFNULL);
pParse->iSelfTab = 0;
pPrior = 0; /* Ticket a9efb42811fa41ee 2019-11-02;
** pPartIdxWhere may have corrupted regPrior registers */
}else{
*piPartIdxLabel = 0;
}

View File

@ -478,7 +478,24 @@ do_execsql_test index6-16.3 {
SELECT 3 FROM t0 WHERE c1 <= c0;
} {3}
# 2019-11-02
# Ticket https://sqlite.org/src/tktview/a9efb42811fa41ee286e8
db close
sqlite3 db :memory:
do_execsql_test index6-17.1 {
CREATE TABLE t0(c0);
CREATE INDEX i0 ON t0(0) WHERE c0 GLOB c0;
INSERT INTO t0 VALUES (0);
CREATE UNIQUE INDEX i1 ON t0(0);
PRAGMA integrity_check;
} {ok}
do_execsql_test index6-17.2 {
CREATE UNIQUE INDEX i2 ON t0(0);
REPLACE INTO t0 VALUES(0);
PRAGMA integrity_check;
} {ok}
do_execsql_test index6-17.3 {
SELECT COUNT(*) FROM t0 WHERE t0.c0 GLOB t0.c0;
} {1}
finish_test