From 24c22753fc88cdba0d6d437977698ae192bc2c9d Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 11 Aug 2020 16:46:21 +0000
Subject: [PATCH 001/169] Remove an unused #define from sqliteInt.h.
FossilOrigin-Name: d5b254f94c1ce6f0f26024d0b9c80e610f7cc891360bc4c2cb116e9eda2874b3
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/sqliteInt.h | 5 -----
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/manifest b/manifest
index e9d8b99f0d..24e02711c2 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Simplify\s#ifdefs\sassociated\swith\sParse.eParseMode.\s\sFix\san\s#ifdef\serror\nassociated\swith\sSQLITE_OMIT_AUTOVACUUM.
-D 2020-08-10T21:01:32.620
+C Remove\san\sunused\s#define\sfrom\ssqliteInt.h.
+D 2020-08-11T16:46:21.464
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -540,7 +540,7 @@ F src/shell.c.in b9b819feede7b85585ab0826490a352e04e2ee46e8132c92597d29972b2be1d
F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd091f
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
-F src/sqliteInt.h a938ad036cc25fd1a9c7ab1586cbd651ac9c99c1ae57f539f88f9a7271f12ac8
+F src/sqliteInt.h a1aa5457ca881cbf5adb55933bf81d7d4889375afb9a0a5df382a451c058087d
F src/sqliteLimit.h 95cb8479ca459496d9c1c6a9f76b38aee12203a56ce1092fe13e50ae2454c032
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -1879,7 +1879,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 680bdc6524ad6af0e74401e96e3a576145042fb865c1582bfaffc11d4ff76a4f
-R b720a86de77c44208b3db65976426d46
+P 5bbd4bddd3b9fa64d134ed62bce3eb4a09456bf24dec2474b5d764a3a3775964
+R 7900fa60897a14c9a17ac68474e8e377
U drh
-Z 737e0d499b7474145d7a36af76d98f48
+Z 02c2f5ca41fb1e8bb469e63056e7212a
diff --git a/manifest.uuid b/manifest.uuid
index 3f92f7acc7..6d0b967899 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5bbd4bddd3b9fa64d134ed62bce3eb4a09456bf24dec2474b5d764a3a3775964
\ No newline at end of file
+d5b254f94c1ce6f0f26024d0b9c80e610f7cc891360bc4c2cb116e9eda2874b3
\ No newline at end of file
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index b4c5325ace..74e854452b 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2552,11 +2552,6 @@ struct AggInfo {
AggInfo *pNext; /* Next in list of them all */
};
-/*
-** Value for AggInfo.iAggMagic when the structure is valid
-*/
-#define AggInfoMagic 0x2059e99e
-
/*
** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
From 8c1fbe81d01e711f14130798fa8b11b79849aa77 Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 11 Aug 2020 17:20:02 +0000
Subject: [PATCH 002/169] Minor comment fixes. No changes to code.
FossilOrigin-Name: 533aeb90085d989078073067172135db98e37e00be84f99757255858126196e4
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/build.c | 2 +-
src/main.c | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/manifest b/manifest
index 24e02711c2..4046d593a5 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\san\sunused\s#define\sfrom\ssqliteInt.h.
-D 2020-08-11T16:46:21.464
+C Minor\scomment\sfixes.\s\sNo\schanges\sto\scode.
+D 2020-08-11T17:20:02.711
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 1439fd9b45d4d1883c53752daef42af489adaa1a1508fa39dedbc9c80ea21a2f
F src/btree.h 7af72bbb4863c331c8f6753277ab40ee67d2a2125a63256d5c25489722ec162b
F src/btreeInt.h 83166f6daeb91062b6ae9ee6247b3ad07e40eba58f3c05ba9e8dedad4ab1ea38
-F src/build.c dde514651cf3cf3a3a64a6e5c62384c01486c6faeabd165b3fe6dec6d2a0e113
+F src/build.c dbdaee54ffef924a070eb6202017e10d6be56baab953ef0a8e714a6def683198
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c e98518d2d3d4029a13c805e07313fb60c877be56db76e90dd5f3af73085d0ce6
@@ -499,7 +499,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 957254a2d0542597455d0d4c640e4e3f3eea8c6d78f04582df03dfc626f07925
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
-F src/main.c f41d2aea8ac534e4054deb893ad93d292f37a214de1a9cff34fbde407ef685e6
+F src/main.c 09580279145f27f3db206ef44dcb3a8875a42644230f79c7e54aff35e71668f0
F src/malloc.c 22d5bdd9fe88ae4fad1b91a1b9735104b82853ffef868f1f05517d60dc1875f5
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@@ -1879,7 +1879,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 5bbd4bddd3b9fa64d134ed62bce3eb4a09456bf24dec2474b5d764a3a3775964
-R 7900fa60897a14c9a17ac68474e8e377
+P d5b254f94c1ce6f0f26024d0b9c80e610f7cc891360bc4c2cb116e9eda2874b3
+R df927782b8411ddf7d3d371ea015b43c
U drh
-Z 02c2f5ca41fb1e8bb469e63056e7212a
+Z 03fa51f515ce3c4ab5e735dd4415ee00
diff --git a/manifest.uuid b/manifest.uuid
index 6d0b967899..166fe6a2bc 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-d5b254f94c1ce6f0f26024d0b9c80e610f7cc891360bc4c2cb116e9eda2874b3
\ No newline at end of file
+533aeb90085d989078073067172135db98e37e00be84f99757255858126196e4
\ No newline at end of file
diff --git a/src/build.c b/src/build.c
index 1b1dc6986c..aa0f919bc6 100644
--- a/src/build.c
+++ b/src/build.c
@@ -4090,7 +4090,7 @@ void sqlite3DefaultRowEst(Index *pIdx){
** table but other parts we are having to guess at, then do not let the
** estimated number of rows in the table be less than 1000 (LogEst 99).
** Failure to do this can cause the indexes for which we do not have
- ** stat1 data to be ignored by the query planner. tag-20200527-1
+ ** stat1 data to be ignored by the query planner.
*/
x = pIdx->pTable->nRowLogEst;
assert( 99==sqlite3LogEst(1000) );
diff --git a/src/main.c b/src/main.c
index 2437426214..831e06e933 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4095,7 +4095,7 @@ int sqlite3_test_control(int op, ...){
** 2020-07-22: Disabling EXTRA_SCHEMA_CHECKS also disables the
** verification of rootpage numbers when parsing the schema. This
** is useful to make it easier to reach strange internal error states
- ** during testing. The EXTRA_SCHEMA_CHECKS settting is always enabled
+ ** during testing. The EXTRA_SCHEMA_CHECKS setting is always enabled
** in production.
*/
case SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS: {
From 91faeec8d095f494852b15952a9835b740045ac8 Mon Sep 17 00:00:00 2001
From: dan
Date: Tue, 11 Aug 2020 18:00:10 +0000
Subject: [PATCH 003/169] Modify a test for corruption within the wal
checkpoint code to account for the pending-byte page. And for the fact that
test configurations might move the pending-byte page.
FossilOrigin-Name: 7dfb74c37e678dde347d9d85846672f82ad282e300e32676330b764be2e4d580
---
manifest | 18 +++++++++---------
manifest.uuid | 2 +-
src/test1.c | 36 ++++++++++++++++++++++++++++++++++++
src/wal.c | 5 +++--
test/corruptL.test | 3 +++
5 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/manifest b/manifest
index 4046d593a5..389f2a6eda 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Minor\scomment\sfixes.\s\sNo\schanges\sto\scode.
-D 2020-08-11T17:20:02.711
+C Modify\sa\stest\sfor\scorruption\swithin\sthe\swal\scheckpoint\scode\sto\saccount\sfor\sthe\spending-byte\spage.\sAnd\sfor\sthe\sfact\sthat\stest\sconfigurations\smight\smove\sthe\spending-byte\spage.
+D 2020-08-11T18:00:10.927
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -545,7 +545,7 @@ F src/sqliteLimit.h 95cb8479ca459496d9c1c6a9f76b38aee12203a56ce1092fe13e50ae2454
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 986b6391f02cd9b53c1d688be55899f6ffddeb8e8014cd83c1b73ff912579a71
-F src/test1.c 77d0bf0140d92e5e8234dd3e158a985fc905e5bd9d94254370d4e9421f7c2224
+F src/test1.c 24b9cd0863ecc4d3920f4999c40e876c2bd92f3cc5879c48b99abe02c546ed18
F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5
F src/test3.c 61798bb0d38b915067a8c8e03f5a534b431181f802659a6616f9b4ff7d872644
F src/test4.c 7c4420e01c577b5c4add2cb03119743b1a357543d347773b9e717195ea967159
@@ -619,7 +619,7 @@ F src/vdbetrace.c fa3bf238002f0bbbdfb66cc8afb0cea284ff9f148d6439bc1f6f2b4c3b7143
F src/vdbevtab.c f99b275366c5fc5e2d99f734729880994ab9500bdafde7fae3b02d562b9d323c
F src/vtab.c 5f5fc793092f53bbdfde296c50f563fb7bda58cf48e9cf6a8bdfbc5abd409845
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c 7a05a519a02ffb7f2a458838a25853c7300c9e6d9ef546ee48469378ac0404f9
+F src/wal.c 69e770e96fd56cc21608992bf2c6f1f3dc5cf2572d0495c6a643b06c3a679f14
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c 2ea911238674e9baaeddf105dddabed92692a01996073c4d4983f9a7efe481f9
@@ -783,7 +783,7 @@ F test/corruptH.test 79801d97ec5c2f9f3c87739aa1ec2eb786f96454
F test/corruptI.test a17bbf54fdde78d43cf3cc34b0057719fd4a173a3d824285b67dc5257c064c7b
F test/corruptJ.test 4d5ccc4bf959464229a836d60142831ef76a5aa4
F test/corruptK.test 5b4212fe346699831c5ad559a62c54e11c0611bdde1ea8423a091f9c01aa32af
-F test/corruptL.test e1a85214e2448ed0baa1810af86ff94d6c359d2677e4867780786d0c61546484
+F test/corruptL.test 22589f503602cc5984e80f27f46c4de2134f24f1515ba2440513c377cb692258
F test/corruptM.test 7d574320e08c1b36caa3e47262061f186367d593a7e305d35f15289cc2c3e067
F test/cost.test 1d156ce9858780a966c062694687afe0343a0ed12d081d071fb57027e726bafc
F test/count.test e0699a15712bc2a4679d60e408921c2cce7f6365a30340e790c98e0f334a9c77
@@ -1879,7 +1879,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 d5b254f94c1ce6f0f26024d0b9c80e610f7cc891360bc4c2cb116e9eda2874b3
-R df927782b8411ddf7d3d371ea015b43c
-U drh
-Z 03fa51f515ce3c4ab5e735dd4415ee00
+P 533aeb90085d989078073067172135db98e37e00be84f99757255858126196e4
+R 2c637809b649b47bb6f5ba118bc14d49
+U dan
+Z be5abcf06cbc6df3ec62ac1d3464aae6
diff --git a/manifest.uuid b/manifest.uuid
index 166fe6a2bc..b97416a298 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-533aeb90085d989078073067172135db98e37e00be84f99757255858126196e4
\ No newline at end of file
+7dfb74c37e678dde347d9d85846672f82ad282e300e32676330b764be2e4d580
\ No newline at end of file
diff --git a/src/test1.c b/src/test1.c
index e9a75d6368..9904402108 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -7802,6 +7802,41 @@ static int SQLITE_TCLAPI test_mmap_warm(
}
}
+/*
+** Usage: test_write_db DB OFFSET DATA
+**
+** Obtain the sqlite3_file* object for the database file for the "main" db
+** of handle DB. Then invoke its xWrite method to write data DATA to offset
+** OFFSET.
+*/
+static int SQLITE_TCLAPI test_write_db(
+ void * clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ sqlite3 *db = 0;
+ Tcl_WideInt iOff = 0;
+ const unsigned char *aData = 0;
+ int nData = 0;
+ sqlite3_file *pFile = 0;
+ int rc;
+
+ if( objc!=4 ){
+ Tcl_WrongNumArgs(interp, 1, objv, "DB OFFSET DATA");
+ return TCL_ERROR;
+ }
+ if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
+ if( Tcl_GetWideIntFromObj(interp, objv[2], &iOff) ) return TCL_ERROR;
+ aData = Tcl_GetByteArrayFromObj(objv[3], &nData);
+
+ sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, (void*)&pFile);
+ rc = pFile->pMethods->xWrite(pFile, aData, nData, iOff);
+
+ Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE);
+ return TCL_OK;
+}
+
/*
** Usage: decode_hexdb TEXT
**
@@ -8166,6 +8201,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_mmap_warm", test_mmap_warm, 0 },
{ "sqlite3_config_sorterref", test_config_sorterref, 0 },
{ "decode_hexdb", test_decode_hexdb, 0 },
+ { "test_write_db", test_write_db, 0 },
};
static int bitmask_size = sizeof(Bitmask)*8;
static int longdouble_size = sizeof(LONGDOUBLE_TYPE);
diff --git a/src/wal.c b/src/wal.c
index 0ef08b1377..ac0a03e93d 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -2009,9 +2009,10 @@ static int walCheckpoint(
sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_START, 0);
rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
if( rc==SQLITE_OK && nSizehdr.mxFrame*szPage)hdr.mxFrame*szPage)
Date: Tue, 11 Aug 2020 18:17:04 +0000
Subject: [PATCH 004/169] New test cases for the use of the ieee754 and decimal
extensions in the CLI.
FossilOrigin-Name: bc1590f32fc4e2696b4126bd0302cb6405031dd4f55b86f3f1611f7f39299f85
---
manifest | 14 ++++++-------
manifest.uuid | 2 +-
test/shell1.test | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 389f2a6eda..fc5173c9cd 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Modify\sa\stest\sfor\scorruption\swithin\sthe\swal\scheckpoint\scode\sto\saccount\sfor\sthe\spending-byte\spage.\sAnd\sfor\sthe\sfact\sthat\stest\sconfigurations\smight\smove\sthe\spending-byte\spage.
-D 2020-08-11T18:00:10.927
+C New\stest\scases\sfor\sthe\suse\sof\sthe\sieee754\sand\sdecimal\sextensions\sin\sthe\sCLI.
+D 2020-08-11T18:17:04.070
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1344,7 +1344,7 @@ F test/sharedA.test 49d87ec54ab640fbbc3786ee3c01de94aaa482a3a9f834ad3fe92770eb69
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
-F test/shell1.test a1cf47c5e110560ff25a714570bfd53bfaceeb61db5cad3072a4064f17ebd10e
+F test/shell1.test 1305efc92f132a1fcf97c00ac02b1b192865b4d33d44cab499e0bdcff71ce045
F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b
F test/shell3.test ac8c2b744014c3e9a0e26bfd829ab65f00923dc1a91ffd044863e9423cc91494
F test/shell4.test 1c6aef11daaa2d6830acaba3ac9cbec93fbc1c3d5530743a637f39b3987d08ce
@@ -1879,7 +1879,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 533aeb90085d989078073067172135db98e37e00be84f99757255858126196e4
-R 2c637809b649b47bb6f5ba118bc14d49
-U dan
-Z be5abcf06cbc6df3ec62ac1d3464aae6
+P 7dfb74c37e678dde347d9d85846672f82ad282e300e32676330b764be2e4d580
+R d77236f2dcbaef13d110aee9e5d1b519
+U drh
+Z 511e843c2e305b6831df80109b36fe79
diff --git a/manifest.uuid b/manifest.uuid
index b97416a298..d4da5af19a 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-7dfb74c37e678dde347d9d85846672f82ad282e300e32676330b764be2e4d580
\ No newline at end of file
+bc1590f32fc4e2696b4126bd0302cb6405031dd4f55b86f3f1611f7f39299f85
\ No newline at end of file
diff --git a/test/shell1.test b/test/shell1.test
index 49af3aa35d..678febaeba 100644
--- a/test/shell1.test
+++ b/test/shell1.test
@@ -1166,4 +1166,57 @@ do_test shell1-7.1.7 {
}
+# Test case for the ieee754 and decimal extensions in the shell.
+# See the "floatingpoint.html" file in the documentation for more
+# information.
+#
+do_test shell1-8.1 {
+ catchcmd ":memory:" {
+ -- The pow2 table will hold all the necessary powers of two.
+ CREATE TABLE pow2(x INTEGER PRIMARY KEY, v TEXT);
+ WITH RECURSIVE c(x,v) AS (
+ VALUES(0,'1')
+ UNION ALL
+ SELECT x+1, decimal_mul(v,'2') FROM c WHERE x+1<=971
+ ) INSERT INTO pow2(x,v) SELECT x, v FROM c;
+ WITH RECURSIVE c(x,v) AS (
+ VALUES(-1,'0.5')
+ UNION ALL
+ SELECT x-1, decimal_mul(v,'0.5') FROM c WHERE x-1>=-1075
+ ) INSERT INTO pow2(x,v) SELECT x, v FROM c;
+
+ -- This query finds the decimal representation of each value in the "c" table.
+ WITH c(n) AS (VALUES(47.49))
+ ----XXXXX----------- Replace with whatever you want
+ SELECT decimal_mul(ieee754_mantissa(c.n),pow2.v)
+ FROM pow2, c WHERE pow2.x=ieee754_exponent(c.n);
+ }
+} {0 47.49000000000000198951966012828052043914794921875}
+do_test shell1-8.2 {
+ catchcmd :memory: {
+.mode box
+SELECT ieee754(47.49) AS x;
+ }
+} {0 {┌───────────────────────────────┐
+│ x │
+├───────────────────────────────┤
+│ ieee754(6683623321994527,-47) │
+└───────────────────────────────┘}}
+do_test shell1-8.3 {
+ catchcmd ":memory: --box" {
+ select ieee754(6683623321994527,-47) as x;
+ }
+} {0 {┌───────┐
+│ x │
+├───────┤
+│ 47.49 │
+└───────┘}}
+do_test shell1-8.4 {
+ catchcmd ":memory: --table" {SELECT ieee754_mantissa(47.49) AS M, ieee754_exponent(47.49) AS E;}
+} {0 {+------------------+-----+
+| M | E |
++------------------+-----+
+| 6683623321994527 | -47 |
++------------------+-----+}}
+
finish_test
From c08716a317ee00de91537da8d2f44092cd0896c0 Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 11 Aug 2020 21:53:42 +0000
Subject: [PATCH 005/169] Fix harmless USAN warnings from gcc9.
FossilOrigin-Name: 72c4c69fea13f5e24df25645e6941ce3ff896f0a3c73cd63329f819cc907ab40
---
ext/fts3/fts3_tokenize_vtab.c | 3 ++-
ext/session/sqlite3session.c | 9 +++++++--
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
test/wapptest.tcl | 3 +--
5 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/ext/fts3/fts3_tokenize_vtab.c b/ext/fts3/fts3_tokenize_vtab.c
index fe6e242840..8bd22230cc 100644
--- a/ext/fts3/fts3_tokenize_vtab.c
+++ b/ext/fts3/fts3_tokenize_vtab.c
@@ -188,7 +188,8 @@ static int fts3tokConnectMethod(
assert( (rc==SQLITE_OK)==(pMod!=0) );
if( rc==SQLITE_OK ){
- const char * const *azArg = (const char * const *)&azDequote[1];
+ const char * const *azArg = 0;
+ if( nDequote>1 ) azArg = (const char * const *)&azDequote[1];
rc = pMod->xCreate((nDequote>1 ? nDequote-1 : 0), azArg, &pTok);
}
diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c
index cb350ab2d4..dae2604719 100644
--- a/ext/session/sqlite3session.c
+++ b/ext/session/sqlite3session.c
@@ -2956,8 +2956,13 @@ static int sessionChangesetReadTblhdr(sqlite3_changeset_iter *p){
}
p->apValue = (sqlite3_value**)p->tblhdr.aBuf;
- p->abPK = (u8*)&p->apValue[p->nCol*2];
- p->zTab = (char*)&p->abPK[p->nCol];
+ if( p->apValue==0 ){
+ p->abPK = 0;
+ p->zTab = 0;
+ }else{
+ p->abPK = (u8*)&p->apValue[p->nCol*2];
+ p->zTab = p->abPK ? (char*)&p->abPK[p->nCol] : 0;
+ }
return (p->rc = rc);
}
diff --git a/manifest b/manifest
index fc5173c9cd..8b171be641 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C New\stest\scases\sfor\sthe\suse\sof\sthe\sieee754\sand\sdecimal\sextensions\sin\sthe\sCLI.
-D 2020-08-11T18:17:04.070
+C Fix\sharmless\sUSAN\swarnings\sfrom\sgcc9.
+D 2020-08-11T21:53:42.164
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -95,7 +95,7 @@ F ext/fts3/fts3_porter.c 3565faf04b626cddf85f03825e86056a4562c009
F ext/fts3/fts3_snippet.c 86e7e947a176f0f005720b3ca17631aca2fd2f9daa6729d4adbf2d16ab1b9613
F ext/fts3/fts3_term.c f45a1e7c6ef464abb1231245d123dae12266b69e05cc56e14045b76591ae92d1
F ext/fts3/fts3_test.c 73b16e229e517c1b1f0fb8e1046182a4e5dbc8dbe6eea8a5d4353fcce7dbbf39
-F ext/fts3/fts3_tokenize_vtab.c cb792f59212f7799bf2891c7d4579bbf568f124ce8fbb0a9902aa5bd577e8b75
+F ext/fts3/fts3_tokenize_vtab.c 8d15b148e7d88a4280389a200b26e8d52abda4c4ec2e9a35e9d7a1fa50e5aa03
F ext/fts3/fts3_tokenizer.c 6d8fc150c48238955d5182bf661498db0dd473c8a2a80e00c16994a646fa96e7
F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
@@ -448,7 +448,7 @@ F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2
F ext/session/sessionrebase.test ccfa716b23bd1d3b03217ee58cfd90c78d4b99f53e6a9a2f05e82363b9142810
F ext/session/sessionstat1.test 218d351cf9fcd6648f125a26b607b140310160184723c2666091b54450a68fb5
F ext/session/sessionwor.test 67b5ab91d4f93ce65ff1f58240ac5ddf73f8670facc1ffa49cef56293d52818d
-F ext/session/sqlite3session.c fc8c6c13dc0456943ff24abf574ced10418eec66a548c97d3eafbebe9fc5e908
+F ext/session/sqlite3session.c 2c76b8c3a5d6dab736686f8a48833b8bdac0871ecc6f447f9839d28bd4a63d6c
F ext/session/sqlite3session.h a2db5b72b938d12c727b4b4ec632254ca493670a9c0de597af3271a7f774fc57
F ext/session/test_session.c 98797aba475a799376c9a42214f2d1debf2d0c3cb657d9c8bbf4f70bf3fb4aec
F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
@@ -1709,7 +1709,7 @@ F test/walslow.test c05c68d4dc2700a982f89133ce103a1a84cc285f
F test/walthread.test 14b20fcfa6ae152f5d8e12f5dc8a8a724b7ef189f5d8ef1e2ceab79f2af51747
F test/walvfs.test a2913001a83b19c1d20220e556cee14d87d47ecb6949b5e0a2e9e2590abecf1e
F test/wapp.tcl b440cd8cf57953d3a49e7ee81e6a18f18efdaf113b69f7d8482b0710a64566ec
-F test/wapptest.tcl 3cca775aede0591756a1fc0da55bbb3715d8c363873fd2cfdd4d555b0a4af57d x
+F test/wapptest.tcl 899594e25684861d5b0c0880fb012364def50ef8097041b8ddf74be5ba7fa270 x
F test/where.test f5e62453537e5b335b69f3b09f8a02ce3328289fad5d866e25371284b837d78d
F test/where2.test 478d2170637b9211f593120648858593bf2445a1
F test/where3.test 2341a294e17193a6b1699ea7f192124a5286ca6acfcc3f4b06d16c931fbcda2c
@@ -1879,7 +1879,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 7dfb74c37e678dde347d9d85846672f82ad282e300e32676330b764be2e4d580
-R d77236f2dcbaef13d110aee9e5d1b519
+P bc1590f32fc4e2696b4126bd0302cb6405031dd4f55b86f3f1611f7f39299f85
+R 90593965634151fdd7567fd15751e825
U drh
-Z 511e843c2e305b6831df80109b36fe79
+Z ecda5fdf34d5afa6fe0822154bd98e39
diff --git a/manifest.uuid b/manifest.uuid
index d4da5af19a..33c2a4d5c2 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-bc1590f32fc4e2696b4126bd0302cb6405031dd4f55b86f3f1611f7f39299f85
\ No newline at end of file
+72c4c69fea13f5e24df25645e6941ce3ff896f0a3c73cd63329f819cc907ab40
\ No newline at end of file
diff --git a/test/wapptest.tcl b/test/wapptest.tcl
index 201078e78d..b7e16e7227 100755
--- a/test/wapptest.tcl
+++ b/test/wapptest.tcl
@@ -164,7 +164,7 @@ proc count_tests_and_errors {name logfile} {
}
if {[regexp {runtime error: +(.*)} $line all msg]} {
# skip over "value is outside range" errors
- if {[regexp {value .* is outside the range of representable} $line]} {
+ if {[regexp {.* is outside the range of representable} $line]} {
# noop
} else {
incr G(test.$name.nError)
@@ -894,4 +894,3 @@ if {$G(noui)==0} {
do_some_stuff
vwait forever
}
-
From b6a74caf9302c0b4f25b461e552cd36df0b9b439 Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 12 Aug 2020 15:39:43 +0000
Subject: [PATCH 006/169] Fix an assertion() fault in ALTER TABLE found by
OSSFuzz. Test case in TH3.
FossilOrigin-Name: 41de742c5713ab1a0c0c15c44af3ffac40bbc527ae2dc11d829ba9773eb4c84a
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/alter.c | 1 +
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/manifest b/manifest
index 8b171be641..d33f4dde8e 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sharmless\sUSAN\swarnings\sfrom\sgcc9.
-D 2020-08-11T21:53:42.164
+C Fix\san\sassertion()\sfault\sin\sALTER\sTABLE\sfound\sby\sOSSFuzz.\s\sTest\scase\sin\sTH3.
+D 2020-08-12T15:39:43.871
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -469,7 +469,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
-F src/alter.c 4bc16666a0df99d49658ec66f00ca36e541ec6cb39673ccc51be6a981fb9b2ce
+F src/alter.c d220ddd24b8990c210d243882cf5114eb599a649718149603d7cd1619094d2e2
F src/analyze.c 5cffff3d355858cd22bfc6e20ac7203510d2e1cc935086eb06f4abb2f579f628
F src/attach.c 0b11e00c166b622c84ec176773b1d691c61ad07d247809e3e1635d4e99e71d30
F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06
@@ -1879,7 +1879,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 bc1590f32fc4e2696b4126bd0302cb6405031dd4f55b86f3f1611f7f39299f85
-R 90593965634151fdd7567fd15751e825
+P 72c4c69fea13f5e24df25645e6941ce3ff896f0a3c73cd63329f819cc907ab40
+R dbb767fdb5a237fc185a964d86a23acf
U drh
-Z ecda5fdf34d5afa6fe0822154bd98e39
+Z f11bc9f93fa54b4ee489a090aeb5fabf
diff --git a/manifest.uuid b/manifest.uuid
index 33c2a4d5c2..30d5854241 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-72c4c69fea13f5e24df25645e6941ce3ff896f0a3c73cd63329f819cc907ab40
\ No newline at end of file
+41de742c5713ab1a0c0c15c44af3ffac40bbc527ae2dc11d829ba9773eb4c84a
\ No newline at end of file
diff --git a/src/alter.c b/src/alter.c
index 91c3b60dcd..f82d06d387 100644
--- a/src/alter.c
+++ b/src/alter.c
@@ -1200,6 +1200,7 @@ static int renameResolveTrigger(Parse *pParse){
p->iCursor = pParse->nTab++;
if( p->pTab==0 ){
rc = SQLITE_ERROR;
+ break;
}else{
p->pTab->nTabRef++;
rc = sqlite3ViewGetColumnNames(pParse, p->pTab);
From a3e6495970590691f05c6fe0057637c1b2bfe6bb Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 12 Aug 2020 16:19:12 +0000
Subject: [PATCH 007/169] Improvement on the previous fix.
FossilOrigin-Name: f6cffa2d50bfebe5b025f412b7a49b7fdafb798aaf1ddc80e6656ccd1f012a7f
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/alter.c | 3 +--
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index d33f4dde8e..2af423ecb7 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\san\sassertion()\sfault\sin\sALTER\sTABLE\sfound\sby\sOSSFuzz.\s\sTest\scase\sin\sTH3.
-D 2020-08-12T15:39:43.871
+C Improvement\son\sthe\sprevious\sfix.
+D 2020-08-12T16:19:12.499
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -469,7 +469,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
-F src/alter.c d220ddd24b8990c210d243882cf5114eb599a649718149603d7cd1619094d2e2
+F src/alter.c 805de23ddca536181f8f0439df989fdd4a2f76c40bc305ec9fe2f211f68c89e8
F src/analyze.c 5cffff3d355858cd22bfc6e20ac7203510d2e1cc935086eb06f4abb2f579f628
F src/attach.c 0b11e00c166b622c84ec176773b1d691c61ad07d247809e3e1635d4e99e71d30
F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06
@@ -1879,7 +1879,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 72c4c69fea13f5e24df25645e6941ce3ff896f0a3c73cd63329f819cc907ab40
-R dbb767fdb5a237fc185a964d86a23acf
+P 41de742c5713ab1a0c0c15c44af3ffac40bbc527ae2dc11d829ba9773eb4c84a
+R e3db7df2c22d39b25a91e89bd22527e7
U drh
-Z f11bc9f93fa54b4ee489a090aeb5fabf
+Z faca665711427ec5fbd1c65de6bd3b9c
diff --git a/manifest.uuid b/manifest.uuid
index 30d5854241..39b681ac7a 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-41de742c5713ab1a0c0c15c44af3ffac40bbc527ae2dc11d829ba9773eb4c84a
\ No newline at end of file
+f6cffa2d50bfebe5b025f412b7a49b7fdafb798aaf1ddc80e6656ccd1f012a7f
\ No newline at end of file
diff --git a/src/alter.c b/src/alter.c
index f82d06d387..c146c2ff91 100644
--- a/src/alter.c
+++ b/src/alter.c
@@ -1194,13 +1194,12 @@ static int renameResolveTrigger(Parse *pParse){
SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
if( pSrc ){
int i;
- for(i=0; inSrc; i++){
+ for(i=0; inSrc && rc==SQLITE_OK; i++){
struct SrcList_item *p = &pSrc->a[i];
p->pTab = sqlite3LocateTableItem(pParse, 0, p);
p->iCursor = pParse->nTab++;
if( p->pTab==0 ){
rc = SQLITE_ERROR;
- break;
}else{
p->pTab->nTabRef++;
rc = sqlite3ViewGetColumnNames(pParse, p->pTab);
From 96e337df6b87c1c731cdf0bad5e2611f93030cae Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 13 Aug 2020 17:27:57 +0000
Subject: [PATCH 008/169] Fix "make test" handling of environment variable
QUICKTEST_OMIT so that it can be used to exclude test files in other than the
main test directory.
FossilOrigin-Name: b050976079ba4a22d4dfeadb81f40cf71da6588c95bf2b634d88b416de5accd7
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
test/permutations.test | 19 +++++++++++++++++--
3 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/manifest b/manifest
index 2af423ecb7..624aa91114 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improvement\son\sthe\sprevious\sfix.
-D 2020-08-12T16:19:12.499
+C Fix\s"make\stest"\shandling\sof\senvironment\svariable\sQUICKTEST_OMIT\sso\sthat\sit\scan\sbe\sused\sto\sexclude\stest\sfiles\sin\sother\sthan\sthe\smain\stest\sdirectory.
+D 2020-08-13T17:27:57.029
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1243,7 +1243,7 @@ F test/parser1.test 6ccdf5e459a5dc4673d3273dc311a7e9742ca952dd0551a6a6320d27035c
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
-F test/permutations.test 4d174cfc92e31aff96a383dac767a94d649566b73857875afb7511e3e430d5f5
+F test/permutations.test 661a4325a5717957a77836910ee164ba26594a502d7a3df0e1ae7b9cba829c5d
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 50b91bedea9324d3ab48e793f908ee7d2c7dcf84bfa2281e792838be59641ec8
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
@@ -1879,7 +1879,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 41de742c5713ab1a0c0c15c44af3ffac40bbc527ae2dc11d829ba9773eb4c84a
-R e3db7df2c22d39b25a91e89bd22527e7
-U drh
-Z faca665711427ec5fbd1c65de6bd3b9c
+P f6cffa2d50bfebe5b025f412b7a49b7fdafb798aaf1ddc80e6656ccd1f012a7f
+R 799818c17104aa7af945cf9f5cad3762
+U dan
+Z eb3d2da01b8eb995a9db8afa1f477ec2
diff --git a/manifest.uuid b/manifest.uuid
index 39b681ac7a..e00414851d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-f6cffa2d50bfebe5b025f412b7a49b7fdafb798aaf1ddc80e6656ccd1f012a7f
\ No newline at end of file
+b050976079ba4a22d4dfeadb81f40cf71da6588c95bf2b634d88b416de5accd7
\ No newline at end of file
diff --git a/test/permutations.test b/test/permutations.test
index 135f2e83c0..4ea6cd2806 100644
--- a/test/permutations.test
+++ b/test/permutations.test
@@ -136,9 +136,24 @@ if {[info exists ::env(QUICKTEST_INCLUDE)]} {
set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
}
if {[info exists ::env(QUICKTEST_OMIT)]} {
- foreach x [split $::env(QUICKTEST_OMIT) ,] {
- regsub -all \\y$x\\y $allquicktests {} allquicktests
+ # If environment variable QUICKTEST_OMIT is set, it is a comma-separated
+ # list of regular expressions to match against test file names in
+ # the "allquicktests" set. Any matches are excluded. Only the filename
+ # is matched, not any directory component of the path.
+ set all [list]
+ foreach a $allquicktests {
+ set bIn 1
+ foreach x [split $::env(QUICKTEST_OMIT) ,] {
+ if {[regexp $x [file tail $a]]} {
+ set bIn 0
+ break
+ }
+ }
+ if {$bIn} {
+ lappend all $a
+ }
}
+ set allquicktests $all
}
# If the TEST_FAILURE environment variable is set, it means that we what to
From ef215fbf3b581ef4e0273bb3932fa522af88fd7e Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 14 Aug 2020 13:23:32 +0000
Subject: [PATCH 009/169] Version 3.33.0
FossilOrigin-Name: fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
---
manifest | 13 ++++++++-----
manifest.uuid | 2 +-
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/manifest b/manifest
index 624aa91114..9122e4aaf4 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\s"make\stest"\shandling\sof\senvironment\svariable\sQUICKTEST_OMIT\sso\sthat\sit\scan\sbe\sused\sto\sexclude\stest\sfiles\sin\sother\sthan\sthe\smain\stest\sdirectory.
-D 2020-08-13T17:27:57.029
+C Version\s3.33.0
+D 2020-08-14T13:23:32.827
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1879,7 +1879,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P f6cffa2d50bfebe5b025f412b7a49b7fdafb798aaf1ddc80e6656ccd1f012a7f
+P b050976079ba4a22d4dfeadb81f40cf71da6588c95bf2b634d88b416de5accd7
R 799818c17104aa7af945cf9f5cad3762
-U dan
-Z eb3d2da01b8eb995a9db8afa1f477ec2
+T +bgcolor * #d0c0ff
+T +sym-release *
+T +sym-version-3.33.0 *
+U drh
+Z 652aa26f564c1138ae3a9226a8f034b3
diff --git a/manifest.uuid b/manifest.uuid
index e00414851d..4231aa8eaf 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-b050976079ba4a22d4dfeadb81f40cf71da6588c95bf2b634d88b416de5accd7
\ No newline at end of file
+fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
\ No newline at end of file
From e0404386f265f2af09777eefb21f97f9333b95bb Mon Sep 17 00:00:00 2001
From: dan
Date: Fri, 14 Aug 2020 16:14:40 +0000
Subject: [PATCH 010/169] Fix an inconsequential memory leak in sqldiff. Update
the "Sanitize" case in wapptest.tcl to use -fsanitize=address,undefined, and
to run more tests.
FossilOrigin-Name: 613fb5c2525be77e48bad0a74e8b7bf53489365060fb9c7713a0caddb1820c71
---
manifest | 19 ++++++++-----------
manifest.uuid | 2 +-
test/releasetest_data.tcl | 7 ++++---
tool/sqldiff.c | 6 +++++-
4 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/manifest b/manifest
index 9122e4aaf4..6d504a5e95 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Version\s3.33.0
-D 2020-08-14T13:23:32.827
+C Fix\san\sinconsequential\smemory\sleak\sin\ssqldiff.\sUpdate\sthe\s"Sanitize"\scase\sin\swapptest.tcl\sto\suse\s-fsanitize=address,undefined,\sand\sto\srun\smore\stests.
+D 2020-08-14T16:14:40.986
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1272,7 +1272,7 @@ F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c
F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d
F test/releasetest.tcl fb76d8fcc95ac29d6356cd9e52b726ab9e43a24082897618dfbcb7c2b0049153 x
-F test/releasetest_data.tcl 9919fc6ac5bc92f8878fecfd1840db15999f660a6c9f609240b41aa62b885c88
+F test/releasetest_data.tcl 9fbb722e2a7c4c8377533f63a66c2de64b0dba982b6dfa6fb434da12518a03a7
F test/resetdb.test 8062cf10a09d8c048f8de7711e94571c38b38168db0e5877ba7561789e5eeb2b
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa
@@ -1844,7 +1844,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd
F tool/split-sqlite3c.tcl 3efcd4240b738f6bb2b5af0aea7e1e0ef9bc1c61654f645076cec883030b710c
-F tool/sqldiff.c 5046b8e227213ad016b336eb5a933e252e1f0fd1e07060c5755e259a30891287
+F tool/sqldiff.c a3362140091b6d8a0771a589aaff147c114b13eb915927390587f0fa78c2040d
F tool/sqlite3_analyzer.c.in 7eeaae8b0d7577662acaabbb11107af0659d1b41bc1dfdd4d91422de27127968
F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898
F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848
@@ -1879,10 +1879,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 b050976079ba4a22d4dfeadb81f40cf71da6588c95bf2b634d88b416de5accd7
-R 799818c17104aa7af945cf9f5cad3762
-T +bgcolor * #d0c0ff
-T +sym-release *
-T +sym-version-3.33.0 *
-U drh
-Z 652aa26f564c1138ae3a9226a8f034b3
+P fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
+R abf6184f2760dd711de23a24f5d6d111
+U dan
+Z 195eaf8a6ab487ff406d08339798a869
diff --git a/manifest.uuid b/manifest.uuid
index 4231aa8eaf..e583a95ed8 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
\ No newline at end of file
+613fb5c2525be77e48bad0a74e8b7bf53489365060fb9c7713a0caddb1820c71
\ No newline at end of file
diff --git a/test/releasetest_data.tcl b/test/releasetest_data.tcl
index bd3f108118..50de1cc71f 100644
--- a/test/releasetest_data.tcl
+++ b/test/releasetest_data.tcl
@@ -54,9 +54,10 @@ array set ::Configs [strip_comments {
-DSQLITE_ENABLE_DESERIALIZE
}
"Sanitize" {
- CC=clang -fsanitize=undefined
+ CC=clang -fsanitize=address,undefined
-DSQLITE_ENABLE_STAT4
- --enable-session
+ --enable-debug
+ --enable-all
}
"Stdcall" {
-DUSE_STDCALL=1
@@ -294,7 +295,7 @@ array set ::Platforms [strip_comments {
"No-lookaside" test
"Devkit" test
"Apple" test
- "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test}
+ "Sanitize" {QUICKTEST_OMIT=crash*,shell*,sqldiff*,sessionB.test test}
"Device-One" fulltest
"Default" "threadtest fulltest"
"Valgrind*" valgrindtest
diff --git a/tool/sqldiff.c b/tool/sqldiff.c
index 3590e2c06a..85cae56de8 100644
--- a/tool/sqldiff.c
+++ b/tool/sqldiff.c
@@ -1544,6 +1544,7 @@ static void changeset_one_table(const char *zTab, FILE *out){
/* Check that the schemas of the two tables match. Exit early otherwise. */
checkSchemasMatch(zTab);
+ strInit(&sql);
pStmt = db_prepare("PRAGMA main.table_info=%Q", zTab);
while( SQLITE_ROW==sqlite3_step(pStmt) ){
@@ -1565,7 +1566,6 @@ static void changeset_one_table(const char *zTab, FILE *out){
}
sqlite3_finalize(pStmt);
if( nPk==0 ) goto end_changeset_one_table;
- strInit(&sql);
if( nCol>nPk ){
strPrintf(&sql, "SELECT %d", SQLITE_UPDATE);
for(i=0; i
Date: Fri, 14 Aug 2020 17:39:31 +0000
Subject: [PATCH 011/169] Experimental change to try to get some DELETE
operations to access values using the index rather than the main table, so as
to avoid unnecessary main table seeks.
FossilOrigin-Name: 2f7cb6ab39e54fd6eb3a280d3022c3d4f4ed92e83af7226e63e0199a96397a6b
---
manifest | 20 ++++++++++----------
manifest.uuid | 2 +-
src/where.c | 8 ++++++--
src/whereInt.h | 1 +
4 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/manifest b/manifest
index 9122e4aaf4..5ba6c36bc4 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Version\s3.33.0
-D 2020-08-14T13:23:32.827
+C Experimental\schange\sto\stry\sto\sget\ssome\sDELETE\soperations\sto\saccess\svalues\nusing\sthe\sindex\srather\sthan\sthe\smain\stable,\sso\sas\sto\savoid\sunnecessary\nmain\stable\sseeks.
+D 2020-08-14T17:39:31.333
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -622,8 +622,8 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 69e770e96fd56cc21608992bf2c6f1f3dc5cf2572d0495c6a643b06c3a679f14
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
-F src/where.c 2ea911238674e9baaeddf105dddabed92692a01996073c4d4983f9a7efe481f9
-F src/whereInt.h 6b874aa15f94e43a2cec1080be64d955b04deeafeac90ffb5d6975c0d511be3c
+F src/where.c 50fe9fc0b929b6c3c7b71a6b7601a942e76512e38a220de948f1c79af237ad9b
+F src/whereInt.h eb8c2847fb464728533777efec1682b3c074224293b2da73513c61a609efbeab
F src/wherecode.c 8064fe5c042824853a9b1fda670054a51a49033a6c79059988c97751ccf8088e
F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
@@ -1879,10 +1879,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P b050976079ba4a22d4dfeadb81f40cf71da6588c95bf2b634d88b416de5accd7
-R 799818c17104aa7af945cf9f5cad3762
-T +bgcolor * #d0c0ff
-T +sym-release *
-T +sym-version-3.33.0 *
+P fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
+R 90cb3c0f751fa2f3ee092ca1f77cf5d7
+T *branch * delete-bytecode-optimization
+T *sym-delete-bytecode-optimization *
+T -sym-trunk *
U drh
-Z 652aa26f564c1138ae3a9226a8f034b3
+Z b9254e6f44cc1c24322dcc5d82dd0b50
diff --git a/manifest.uuid b/manifest.uuid
index 4231aa8eaf..d83942f49c 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
\ No newline at end of file
+2f7cb6ab39e54fd6eb3a280d3022c3d4f4ed92e83af7226e63e0199a96397a6b
\ No newline at end of file
diff --git a/src/where.c b/src/where.c
index e3f74351fd..79c7b63d73 100644
--- a/src/where.c
+++ b/src/where.c
@@ -5246,6 +5246,7 @@ WhereInfo *sqlite3WhereBegin(
/* Done. */
VdbeModuleComment((v, "Begin WHERE-core"));
+ pWInfo->iEndWhere = sqlite3VdbeCurrentAddr(v);
return pWInfo;
/* Jump here if malloc fails */
@@ -5484,10 +5485,13 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
pIdx = pLevel->u.pCovidx;
}
if( pIdx
- && (pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable))
&& !db->mallocFailed
){
- last = sqlite3VdbeCurrentAddr(v);
+ if( pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable) ){
+ last = sqlite3VdbeCurrentAddr(v);
+ }else{
+ last = pWInfo->iEndWhere;
+ }
k = pLevel->addrBody;
#ifdef SQLITE_DEBUG
if( db->flags & SQLITE_VdbeAddopTrace ){
diff --git a/src/whereInt.h b/src/whereInt.h
index e33dde55e2..e8df283d71 100644
--- a/src/whereInt.h
+++ b/src/whereInt.h
@@ -488,6 +488,7 @@ struct WhereInfo {
unsigned sorted :1; /* True if really sorted (not just grouped) */
LogEst nRowOut; /* Estimated number of output rows */
int iTop; /* The very beginning of the WHERE loop */
+ int iEndWhere; /* End of the WHERE clause itself */
WhereLoop *pLoops; /* List of all WhereLoop objects */
WhereExprMod *pExprMods; /* Expression modifications */
Bitmask revMask; /* Mask of ORDER BY terms that need reversing */
From 68c0c71065354a2c06e3283f0a2f1758afec5aba Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 14 Aug 2020 20:04:26 +0000
Subject: [PATCH 012/169] For UPDATE and DELETE, use OP_DeferredSeek always.
If the seek must later be resolved, add the OP_FinishSeek opcode after all
WHERE clause terms have been processed. This obviates the need for the
WHERE_SEEK_TABLE and WHERE_SEEK_UNIQ_TABLE flags to sqlite3WhereBegin() and
the ensuing complication, and it allows the covering index optimization to be
used further into WHERE clause processing.
FossilOrigin-Name: a495f60d315e34b1a1bc5fb1336e05047add52c8fb2710b577c97b10a5e734f6
---
manifest | 21 +++++++++------------
manifest.uuid | 2 +-
src/delete.c | 13 +++++--------
src/sqliteInt.h | 4 ++--
src/update.c | 2 +-
src/wherecode.c | 19 +++++--------------
6 files changed, 23 insertions(+), 38 deletions(-)
diff --git a/manifest b/manifest
index 5ba6c36bc4..351e74e6a9 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Experimental\schange\sto\stry\sto\sget\ssome\sDELETE\soperations\sto\saccess\svalues\nusing\sthe\sindex\srather\sthan\sthe\smain\stable,\sso\sas\sto\savoid\sunnecessary\nmain\stable\sseeks.
-D 2020-08-14T17:39:31.333
+C For\sUPDATE\sand\sDELETE,\suse\sOP_DeferredSeek\salways.\s\sIf\sthe\sseek\smust\slater\nbe\sresolved,\sadd\sthe\sOP_FinishSeek\sopcode\safter\sall\sWHERE\sclause\sterms\shave\nbeen\sprocessed.\s\sThis\sobviates\sthe\sneed\sfor\sthe\sWHERE_SEEK_TABLE\sand\nWHERE_SEEK_UNIQ_TABLE\sflags\sto\ssqlite3WhereBegin()\sand\sthe\sensuing\ncomplication,\sand\sit\sallows\sthe\scovering\sindex\soptimization\sto\sbe\sused\nfurther\sinto\sWHERE\sclause\sprocessing.
+D 2020-08-14T20:04:26.522
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -486,7 +486,7 @@ F src/ctime.c e98518d2d3d4029a13c805e07313fb60c877be56db76e90dd5f3af73085d0ce6
F src/date.c dace306a10d9b02ee553d454c8e1cf8d3c9b932e137738a6b15b90253a9bfc10
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
-F src/delete.c 410c771c25afc113c273d9efad6ab6881bda28c75a1838b9d2c52ba20d1dc704
+F src/delete.c a2a603ab07cced8560065b0e2c4c9c842f2c5a2fd43d87355f95eb53bae7fe21
F src/expr.c 58c06940d964c2cf455b979cf66a648499d294a5ee6dadcaeaed447257c1dc75
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 83372403298e6a7dd989a47aaacdbaa5b4307b5199dbd56e07d4896066b3de72
@@ -540,7 +540,7 @@ F src/shell.c.in b9b819feede7b85585ab0826490a352e04e2ee46e8132c92597d29972b2be1d
F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd091f
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
-F src/sqliteInt.h a1aa5457ca881cbf5adb55933bf81d7d4889375afb9a0a5df382a451c058087d
+F src/sqliteInt.h 86ad0f9164cbadb2ba9598cc6cf5b32bdb47b343c0da5ca62f3d73b60be55b65
F src/sqliteLimit.h 95cb8479ca459496d9c1c6a9f76b38aee12203a56ce1092fe13e50ae2454c032
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -602,7 +602,7 @@ F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 4dc01b267593537e2a0d0efe9f80dabe24c5b6f7627bc6971c487fa6a1dacbbf
F src/treeview.c 4b92992176fb2caefbe06ba5bd06e0e0ebcde3d5564758da672631f17aa51cda
F src/trigger.c ef67bde309a831515dc3c2173d792574309f2f42d45f8c078743fae9f7f98c75
-F src/update.c fb15bec5b54fd098f4b84f6abc83c7103b45ba8484011fff8edf5ae31656eab6
+F src/update.c 55a6203008d033fc1a9c125d7a0a61efdb79bbb2e6db427b917d1d427b4639be
F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c8bf30c4356b091bcc3b624d0e24b2b4d11b8be4d6c90d8e0705971e15cc819b
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c 50fe9fc0b929b6c3c7b71a6b7601a942e76512e38a220de948f1c79af237ad9b
F src/whereInt.h eb8c2847fb464728533777efec1682b3c074224293b2da73513c61a609efbeab
-F src/wherecode.c 8064fe5c042824853a9b1fda670054a51a49033a6c79059988c97751ccf8088e
+F src/wherecode.c cb9bc7cef99578c99baceafeea9c9bcc738d5be37f56dbfe3a1c61ea52483fd0
F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1879,10 +1879,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 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
-R 90cb3c0f751fa2f3ee092ca1f77cf5d7
-T *branch * delete-bytecode-optimization
-T *sym-delete-bytecode-optimization *
-T -sym-trunk *
+P 2f7cb6ab39e54fd6eb3a280d3022c3d4f4ed92e83af7226e63e0199a96397a6b
+R 02225c94aba95601035e446dd1dfb037
U drh
-Z b9254e6f44cc1c24322dcc5d82dd0b50
+Z 6927cf3647c698c9871735d62c2df08c
diff --git a/manifest.uuid b/manifest.uuid
index d83942f49c..c660dbf67d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-2f7cb6ab39e54fd6eb3a280d3022c3d4f4ed92e83af7226e63e0199a96397a6b
\ No newline at end of file
+a495f60d315e34b1a1bc5fb1336e05047add52c8fb2710b577c97b10a5e734f6
\ No newline at end of file
diff --git a/src/delete.c b/src/delete.c
index ae2f85b3a9..bfb486fa54 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -425,7 +425,7 @@ void sqlite3DeleteFrom(
}else
#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
{
- u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK|WHERE_SEEK_TABLE;
+ u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
if( HasRowid(pTab) ){
@@ -461,6 +461,9 @@ void sqlite3DeleteFrom(
assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI );
assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF );
if( eOnePass!=ONEPASS_SINGLE ) sqlite3MultiWrite(pParse);
+ if( sqlite3WhereUsesDeferredSeek(pWInfo) ){
+ sqlite3VdbeAddOp1(v, OP_FinishSeek, iTabCur);
+ }
/* Keep track of the number of rows to be deleted */
if( memCnt ){
@@ -495,6 +498,7 @@ void sqlite3DeleteFrom(
if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iTabCur] = 0;
if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iTabCur] = 0;
if( addrEphOpen ) sqlite3VdbeChangeToNoop(v, addrEphOpen);
+ addrBypass = sqlite3VdbeMakeLabel(pParse);
}else{
if( pPk ){
/* Add the PK key for this row to the temporary table */
@@ -508,13 +512,6 @@ void sqlite3DeleteFrom(
nKey = 1; /* OP_DeferredSeek always uses a single rowid */
sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, iKey);
}
- }
-
- /* If this DELETE cannot use the ONEPASS strategy, this is the
- ** end of the WHERE loop */
- if( eOnePass!=ONEPASS_OFF ){
- addrBypass = sqlite3VdbeMakeLabel(pParse);
- }else{
sqlite3WhereEnd(pWInfo);
}
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 74e854452b..a5d108b6c7 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2953,9 +2953,9 @@ struct SrcList {
#define WHERE_DISTINCTBY 0x0080 /* pOrderby is really a DISTINCT clause */
#define WHERE_WANT_DISTINCT 0x0100 /* All output needs to be distinct */
#define WHERE_SORTBYGROUP 0x0200 /* Support sqlite3WhereIsSorted() */
-#define WHERE_SEEK_TABLE 0x0400 /* Do not defer seeks on main table */
+ /* 0x0400 not currently used */
#define WHERE_ORDERBY_LIMIT 0x0800 /* ORDERBY+LIMIT on the inner loop */
-#define WHERE_SEEK_UNIQ_TABLE 0x1000 /* Do not defer seeks if unique */
+ /* 0x1000 not currently used */
/* 0x2000 not currently used */
#define WHERE_USE_LIMIT 0x4000 /* Use the LIMIT in cost estimates */
/* 0x8000 not currently used */
diff --git a/src/update.c b/src/update.c
index a9c43d62eb..3c9fd9eb11 100644
--- a/src/update.c
+++ b/src/update.c
@@ -705,7 +705,7 @@ void sqlite3Update(
** be deleted as a result of REPLACE conflict handling. Any of these
** things might disturb a cursor being used to scan through the table
** or index, causing a single-pass approach to malfunction. */
- flags = WHERE_ONEPASS_DESIRED|WHERE_SEEK_UNIQ_TABLE;
+ flags = WHERE_ONEPASS_DESIRED;
if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
flags |= WHERE_ONEPASS_MULTIROW;
}
diff --git a/src/wherecode.c b/src/wherecode.c
index 5473a0282e..ece2c754d1 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1909,17 +1909,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
if( omitTable ){
/* pIdx is a covering index. No need to access the main table. */
}else if( HasRowid(pIdx->pTable) ){
- if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)
- || ( (pWInfo->wctrlFlags & WHERE_SEEK_UNIQ_TABLE)!=0
- && (pWInfo->eOnePass==ONEPASS_SINGLE || pLoop->nLTerm==0) )
- ){
- iRowidReg = ++pParse->nMem;
- sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
- sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
- VdbeCoverage(v);
- }else{
- codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur);
- }
+ codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur);
}else if( iCur!=iIdxCur ){
Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable);
iRowidReg = sqlite3GetTempRange(pParse, pPk->nKeyCol);
@@ -2046,7 +2036,6 @@ Bitmask sqlite3WhereCodeOneLoopStart(
int iRetInit; /* Address of regReturn init */
int untestedTerms = 0; /* Some terms not completely tested */
int ii; /* Loop counter */
- u16 wctrlFlags; /* Flags for sub-WHERE clause */
Expr *pAndExpr = 0; /* An ".. AND (...)" expression */
Table *pTab = pTabItem->pTab;
@@ -2147,7 +2136,6 @@ Bitmask sqlite3WhereCodeOneLoopStart(
** eliminating duplicates from other WHERE clauses, the action for each
** sub-WHERE clause is to to invoke the main loop body as a subroutine.
*/
- wctrlFlags = WHERE_OR_SUBCLAUSE | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE);
ExplainQueryPlan((pParse, 1, "MULTI-INDEX OR"));
for(ii=0; iinTerm; ii++){
WhereTerm *pOrTerm = &pOrWc->a[ii];
@@ -2166,7 +2154,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
ExplainQueryPlan((pParse, 1, "INDEX %d", ii+1));
WHERETRACE(0xffff, ("Subplan for OR-clause:\n"));
pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0,
- wctrlFlags, iCovCur);
+ WHERE_OR_SUBCLAUSE, iCovCur);
assert( pSubWInfo || pParse->nErr || db->mallocFailed );
if( pSubWInfo ){
WhereLoop *pSubLoop;
@@ -2264,6 +2252,9 @@ Bitmask sqlite3WhereCodeOneLoopStart(
}else{
pCov = 0;
}
+ if( sqlite3WhereUsesDeferredSeek(pSubWInfo) ){
+ pWInfo->bDeferredSeek = 1;
+ }
/* Finish the loop through table entries that match term pOrTerm. */
sqlite3WhereEnd(pSubWInfo);
From f8556d0106e57c1599a6e4171a9e5f3ed1e81822 Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 14 Aug 2020 21:32:16 +0000
Subject: [PATCH 013/169] Optimizations to the logic that converts main table
accesses into equivalent index accesses. Code is now slightly smaller and
faster than trunk.
FossilOrigin-Name: 611b640442025e57b8e161f8ddac1f19bd3be9a3d5266f4cef287595c3ed9257
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/where.c | 26 +++++++++++++++++++-------
3 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/manifest b/manifest
index 351e74e6a9..b1f787fcdf 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C For\sUPDATE\sand\sDELETE,\suse\sOP_DeferredSeek\salways.\s\sIf\sthe\sseek\smust\slater\nbe\sresolved,\sadd\sthe\sOP_FinishSeek\sopcode\safter\sall\sWHERE\sclause\sterms\shave\nbeen\sprocessed.\s\sThis\sobviates\sthe\sneed\sfor\sthe\sWHERE_SEEK_TABLE\sand\nWHERE_SEEK_UNIQ_TABLE\sflags\sto\ssqlite3WhereBegin()\sand\sthe\sensuing\ncomplication,\sand\sit\sallows\sthe\scovering\sindex\soptimization\sto\sbe\sused\nfurther\sinto\sWHERE\sclause\sprocessing.
-D 2020-08-14T20:04:26.522
+C Optimizations\sto\sthe\slogic\sthat\sconverts\smain\stable\saccesses\sinto\sequivalent\nindex\saccesses.\s\sCode\sis\snow\sslightly\ssmaller\sand\sfaster\sthan\strunk.
+D 2020-08-14T21:32:16.882
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -622,7 +622,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 69e770e96fd56cc21608992bf2c6f1f3dc5cf2572d0495c6a643b06c3a679f14
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
-F src/where.c 50fe9fc0b929b6c3c7b71a6b7601a942e76512e38a220de948f1c79af237ad9b
+F src/where.c 396ba2c62defd56283ef54a4b221f698f4733fe8fbfca4aa8b1cc4f8c58d12ee
F src/whereInt.h eb8c2847fb464728533777efec1682b3c074224293b2da73513c61a609efbeab
F src/wherecode.c cb9bc7cef99578c99baceafeea9c9bcc738d5be37f56dbfe3a1c61ea52483fd0
F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7
@@ -1879,7 +1879,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 2f7cb6ab39e54fd6eb3a280d3022c3d4f4ed92e83af7226e63e0199a96397a6b
-R 02225c94aba95601035e446dd1dfb037
+P a495f60d315e34b1a1bc5fb1336e05047add52c8fb2710b577c97b10a5e734f6
+R 54b8b0b6f00b6cfab28e2e5a52014ff6
U drh
-Z 6927cf3647c698c9871735d62c2df08c
+Z a854ac35ef1e1fa9d5bc731176f5cbf6
diff --git a/manifest.uuid b/manifest.uuid
index c660dbf67d..b2a145b0f4 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-a495f60d315e34b1a1bc5fb1336e05047add52c8fb2710b577c97b10a5e734f6
\ No newline at end of file
+611b640442025e57b8e161f8ddac1f19bd3be9a3d5266f4cef287595c3ed9257
\ No newline at end of file
diff --git a/src/where.c b/src/where.c
index 79c7b63d73..67116c6698 100644
--- a/src/where.c
+++ b/src/where.c
@@ -5290,6 +5290,7 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
WhereLoop *pLoop;
SrcList *pTabList = pWInfo->pTabList;
sqlite3 *db = pParse->db;
+ int iEnd = sqlite3VdbeCurrentAddr(v);
/* Generate loop termination code.
*/
@@ -5427,7 +5428,7 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
assert( pWInfo->nLevel<=pTabList->nSrc );
for(i=0, pLevel=pWInfo->a; inLevel; i++, pLevel++){
int k, last;
- VdbeOp *pOp;
+ VdbeOp *pOp, *pLastOp;
Index *pIdx = 0;
struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];
Table *pTab = pTabItem->pTab;
@@ -5488,20 +5489,28 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
&& !db->mallocFailed
){
if( pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable) ){
- last = sqlite3VdbeCurrentAddr(v);
+ last = iEnd;
}else{
last = pWInfo->iEndWhere;
}
- k = pLevel->addrBody;
+ k = pLevel->addrBody + 1;
#ifdef SQLITE_DEBUG
if( db->flags & SQLITE_VdbeAddopTrace ){
printf("TRANSLATE opcodes in range %d..%d\n", k, last-1);
}
+ /* Proof that the "+1" on the k value above is safe */
+ pOp = sqlite3VdbeGetOp(v, k - 1);
+ assert( pOp->opcode!=OP_Column || pOp->p1!=pLevel->iTabCur );
+ assert( pOp->opcode!=OP_Rowid || pOp->p1!=pLevel->iTabCur );
+ assert( pOp->opcode!=OP_IfNullRow || pOp->p1!=pLevel->iTabCur );
#endif
pOp = sqlite3VdbeGetOp(v, k);
- for(; kp1!=pLevel->iTabCur ) continue;
- if( pOp->opcode==OP_Column
+ pLastOp = pOp + (last - k);
+ assert( pOpp1!=pLevel->iTabCur ){
+ /* no-op */
+ }else if( pOp->opcode==OP_Column
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
|| pOp->opcode==OP_Offset
#endif
@@ -5532,7 +5541,10 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
pOp->p1 = pLevel->iIdxCur;
OpcodeRewriteTrace(db, k, pOp);
}
- }
+#ifdef SQLITE_DEBUG
+ k++;
+#endif
+ }while( (++pOp)flags & SQLITE_VdbeAddopTrace ) printf("TRANSLATE complete\n");
#endif
From a3d6d6a93fc87eba1ccb52d6f72d79ab6b378f69 Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 14 Aug 2020 21:37:32 +0000
Subject: [PATCH 014/169] Update the version number to 3.34.0 for the next
development cycle.
FossilOrigin-Name: 70f34f3df5358d36c8578afbc05756450c46da36b8dce339ed87fc0b9d4057cb
---
VERSION | 2 +-
configure | 18 +++++++++---------
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/VERSION b/VERSION
index 949654dc3e..5c0e053417 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.33.0
+3.34.0
diff --git a/configure b/configure
index 9ba67e99ef..352e61aa25 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sqlite 3.33.0.
+# Generated by GNU Autoconf 2.69 for sqlite 3.34.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.33.0'
-PACKAGE_STRING='sqlite 3.33.0'
+PACKAGE_VERSION='3.34.0'
+PACKAGE_STRING='sqlite 3.34.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1467,7 +1467,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures sqlite 3.33.0 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.34.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1532,7 +1532,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sqlite 3.33.0:";;
+ short | recursive ) echo "Configuration of sqlite 3.34.0:";;
esac
cat <<\_ACEOF
@@ -1659,7 +1659,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sqlite configure 3.33.0
+sqlite configure 3.34.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2078,7 +2078,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by sqlite $as_me 3.33.0, which was
+It was created by sqlite $as_me 3.34.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -12243,7 +12243,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by sqlite $as_me 3.33.0, which was
+This file was extended by sqlite $as_me 3.34.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12309,7 +12309,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-sqlite config.status 3.33.0
+sqlite config.status 3.34.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/manifest b/manifest
index 6d504a5e95..bdf8aea869 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\san\sinconsequential\smemory\sleak\sin\ssqldiff.\sUpdate\sthe\s"Sanitize"\scase\sin\swapptest.tcl\sto\suse\s-fsanitize=address,undefined,\sand\sto\srun\smore\stests.
-D 2020-08-14T16:14:40.986
+C Update\sthe\sversion\snumber\sto\s3.34.0\sfor\sthe\snext\sdevelopment\scycle.
+D 2020-08-14T21:37:32.306
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -7,7 +7,7 @@ F Makefile.in 19374a5db06c3199ec1bab71ab74a103d8abf21053c05e9389255dc58083f806
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
F Makefile.msc 48f5a3fc32672c09ad73795749f6253e406a31526935fbbffd8f021108d54574
F README.md 1514a365ffca3c138e00c5cc839906108a01011a6b082bad19b09781e3aa498a
-F VERSION 5db2ee2cfcc790af73775fa485c13b2e8ccaa5936c6e1f47aedeba7056041ca5
+F VERSION 4027b9aea92d64385570778ebd14388c0b23e92aafda15e7b89c45886c9b920a
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
@@ -34,7 +34,7 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6
F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc
F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559
-F configure a97f98dfff699495aef66ae3d9c424345778a663f583e0d6e7522670518f87c1 x
+F configure 63af83d31b9fdf304f2dbb1e1638530d4ceff31702d1e19550d1fbf3bdf9471e x
F configure.ac 40d01e89cb325c28b33f5957e61fede0bd17da2b5e37d9b223a90c8a318e88d4
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
@@ -1879,7 +1879,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 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
-R abf6184f2760dd711de23a24f5d6d111
-U dan
-Z 195eaf8a6ab487ff406d08339798a869
+P 613fb5c2525be77e48bad0a74e8b7bf53489365060fb9c7713a0caddb1820c71
+R 7059606023c2b57d0babed42e5e9e33d
+U drh
+Z e2c81a93805f9b05654ffbbe167428db
diff --git a/manifest.uuid b/manifest.uuid
index e583a95ed8..3698b1361b 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-613fb5c2525be77e48bad0a74e8b7bf53489365060fb9c7713a0caddb1820c71
\ No newline at end of file
+70f34f3df5358d36c8578afbc05756450c46da36b8dce339ed87fc0b9d4057cb
\ No newline at end of file
From 398221e2ad4b553621df09d73b1d0931a52ff269 Mon Sep 17 00:00:00 2001
From: drh
Date: Sat, 15 Aug 2020 19:58:59 +0000
Subject: [PATCH 015/169] Omit the unnecessary not-NULL check on the upper
bound of a forward index range scan. The subsequent OP_IdxGT will always
catch the NULL. Similarly, omit the not-NULL check on the lower bound of a
reverse index range scan, as the SeekLE opcode will disallow the NULL.
FossilOrigin-Name: e51ecadcbdef5ce6e41d68412aee70aa4a1416c850358a6fa7e9a1ab443e719d
---
manifest | 13 ++++++-------
manifest.uuid | 2 +-
src/wherecode.c | 6 ++++--
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/manifest b/manifest
index 9ccd565137..9b479bfa56 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C When\sdoing\san\sUPDATE\sor\sDELETE\susing\sa\smulti-column\sindex\swhere\sonly\sa\sfew\nof\sthe\searlier\scolumns\sof\sthe\sindex\sare\suseful\sfor\sthe\sindex\slookup,\npostpone\sdoing\sthe\smain\stable\sseek\suntil\safter\sall\sWHERE\sclause\sconstraints\nhave\sbeen\sevaluated,\sin\scase\sthose\sconstraints\scan\sbe\scovered\sby\sunused\nlater\sterms\sof\sthe\sindex,\sthus\savoiding\sunnecessary\smain\stable\sseeks.
-D 2020-08-14T21:51:02.627
+C Omit\sthe\sunnecessary\snot-NULL\scheck\son\sthe\supper\sbound\sof\sa\sforward\sindex\nrange\sscan.\s\sThe\ssubsequent\sOP_IdxGT\swill\salways\scatch\sthe\sNULL.\s\sSimilarly,\nomit\sthe\snot-NULL\scheck\son\sthe\slower\sbound\sof\sa\sreverse\sindex\srange\sscan,\nas\sthe\sSeekLE\sopcode\swill\sdisallow\sthe\sNULL.
+D 2020-08-15T19:58:59.495
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c 396ba2c62defd56283ef54a4b221f698f4733fe8fbfca4aa8b1cc4f8c58d12ee
F src/whereInt.h eb8c2847fb464728533777efec1682b3c074224293b2da73513c61a609efbeab
-F src/wherecode.c cb9bc7cef99578c99baceafeea9c9bcc738d5be37f56dbfe3a1c61ea52483fd0
+F src/wherecode.c 110fa357bf453e0d30bf5ebb2cc86ea34a3631c39b857f30c228fd325cb53ae7
F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1879,8 +1879,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 70f34f3df5358d36c8578afbc05756450c46da36b8dce339ed87fc0b9d4057cb 611b640442025e57b8e161f8ddac1f19bd3be9a3d5266f4cef287595c3ed9257
-R fd23b928eb9c7a62b3f6e9653824ff24
-T +closed 611b640442025e57b8e161f8ddac1f19bd3be9a3d5266f4cef287595c3ed9257
+P 7fee0b1075d622835dc6828c061be516102da9e2809f52d9ab7c4bbef7dfb871
+R 4ca85f2291e05990c70f5c4c2f0f7c45
U drh
-Z 5d0dae315c2c275d1ce9160adcb43cdc
+Z c2f4d1de0fc44fa1e0f3e0d1d11812a8
diff --git a/manifest.uuid b/manifest.uuid
index 44b1baae1f..4dbdaad191 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-7fee0b1075d622835dc6828c061be516102da9e2809f52d9ab7c4bbef7dfb871
\ No newline at end of file
+e51ecadcbdef5ce6e41d68412aee70aa4a1416c850358a6fa7e9a1ab443e719d
\ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index ece2c754d1..145b6fa5f5 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1755,7 +1755,8 @@ Bitmask sqlite3WhereCodeOneLoopStart(
Expr *pRight = pRangeStart->pExpr->pRight;
codeExprOrVector(pParse, pRight, regBase+nEq, nBtm);
whereLikeOptimizationStringFixup(v, pLevel, pRangeStart);
- if( (pRangeStart->wtFlags & TERM_VNULL)==0
+ if( !bRev
+ && (pRangeStart->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
@@ -1833,7 +1834,8 @@ Bitmask sqlite3WhereCodeOneLoopStart(
Expr *pRight = pRangeEnd->pExpr->pRight;
codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
- if( (pRangeEnd->wtFlags & TERM_VNULL)==0
+ if( bRev
+ && (pRangeEnd->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
From f0b41745c5142a4c1c8ad311a4b15330284264c8 Mon Sep 17 00:00:00 2001
From: drh
Date: Sat, 15 Aug 2020 21:55:14 +0000
Subject: [PATCH 016/169] Avoid unnecessary calls to the sqlite3GetVdbe()
routine. Add assert() statements to prove each call is unnecessary.
FossilOrigin-Name: 86d3790caf92e9cb7a9aaaa110f309b4b6945ac30cfd53fc3e5aa1ec3075ada5
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/build.c | 4 +---
src/insert.c | 6 +++---
4 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/manifest b/manifest
index 9b479bfa56..444664d2aa 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Omit\sthe\sunnecessary\snot-NULL\scheck\son\sthe\supper\sbound\sof\sa\sforward\sindex\nrange\sscan.\s\sThe\ssubsequent\sOP_IdxGT\swill\salways\scatch\sthe\sNULL.\s\sSimilarly,\nomit\sthe\snot-NULL\scheck\son\sthe\slower\sbound\sof\sa\sreverse\sindex\srange\sscan,\nas\sthe\sSeekLE\sopcode\swill\sdisallow\sthe\sNULL.
-D 2020-08-15T19:58:59.495
+C Avoid\sunnecessary\scalls\sto\sthe\ssqlite3GetVdbe()\sroutine.\s\sAdd\sassert()\nstatements\sto\sprove\seach\scall\sis\sunnecessary.
+D 2020-08-15T21:55:14.374
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 1439fd9b45d4d1883c53752daef42af489adaa1a1508fa39dedbc9c80ea21a2f
F src/btree.h 7af72bbb4863c331c8f6753277ab40ee67d2a2125a63256d5c25489722ec162b
F src/btreeInt.h 83166f6daeb91062b6ae9ee6247b3ad07e40eba58f3c05ba9e8dedad4ab1ea38
-F src/build.c dbdaee54ffef924a070eb6202017e10d6be56baab953ef0a8e714a6def683198
+F src/build.c 20637935b1e340c91c1f977f0806a647cf37d4404f0dc9d85a0ada2a97321e6c
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c e98518d2d3d4029a13c805e07313fb60c877be56db76e90dd5f3af73085d0ce6
@@ -496,7 +496,7 @@ F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
F src/hash.h 9d56a9079d523b648774c1784b74b89bd93fac7b365210157482e4319a468f38
F src/hwtime.h cb1d7e3e1ed94b7aa6fde95ae2c2daccc3df826be26fc9ed7fd90d1750ae6144
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
-F src/insert.c 957254a2d0542597455d0d4c640e4e3f3eea8c6d78f04582df03dfc626f07925
+F src/insert.c 38abe677d1fbcdf30e58f335a85aa1f6cab131335128a4b32e069c5c784f961d
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
F src/main.c 09580279145f27f3db206ef44dcb3a8875a42644230f79c7e54aff35e71668f0
@@ -1879,7 +1879,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 7fee0b1075d622835dc6828c061be516102da9e2809f52d9ab7c4bbef7dfb871
-R 4ca85f2291e05990c70f5c4c2f0f7c45
+P e51ecadcbdef5ce6e41d68412aee70aa4a1416c850358a6fa7e9a1ab443e719d
+R efbcf9be3b3a890db43b8ca127b0dc88
U drh
-Z c2f4d1de0fc44fa1e0f3e0d1d11812a8
+Z e7716cf2731eceb23b87ee8b9b7f7346
diff --git a/manifest.uuid b/manifest.uuid
index 4dbdaad191..c8a17a0977 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-e51ecadcbdef5ce6e41d68412aee70aa4a1416c850358a6fa7e9a1ab443e719d
\ No newline at end of file
+86d3790caf92e9cb7a9aaaa110f309b4b6945ac30cfd53fc3e5aa1ec3075ada5
\ No newline at end of file
diff --git a/src/build.c b/src/build.c
index aa0f919bc6..5d71b96690 100644
--- a/src/build.c
+++ b/src/build.c
@@ -90,9 +90,7 @@ void sqlite3TableLock(
*/
static void codeTableLocks(Parse *pParse){
int i;
- Vdbe *pVdbe;
-
- pVdbe = sqlite3GetVdbe(pParse);
+ Vdbe *pVdbe = pParse->pVdbe;
assert( pVdbe!=0 ); /* sqlite3GetVdbe cannot fail: VDBE already allocated */
for(i=0; inTableLock; i++){
diff --git a/src/insert.c b/src/insert.c
index 789b3b6634..a4759ea766 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1531,7 +1531,7 @@ void sqlite3GenerateConstraintChecks(
isUpdate = regOldData!=0;
db = pParse->db;
- v = sqlite3GetVdbe(pParse);
+ v = pParse->pVdbe;
assert( v!=0 );
assert( pTab->pSelect==0 ); /* This table is not a VIEW */
nCol = pTab->nCol;
@@ -2304,7 +2304,7 @@ void sqlite3CompleteInsertion(
|| update_flags==(OPFLAG_ISUPDATE|OPFLAG_SAVEPOSITION)
);
- v = sqlite3GetVdbe(pParse);
+ v = pParse->pVdbe;
assert( v!=0 );
assert( pTab->pSelect==0 ); /* This table is not a VIEW */
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
@@ -2405,7 +2405,7 @@ int sqlite3OpenTableAndIndices(
return 0;
}
iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
- v = sqlite3GetVdbe(pParse);
+ v = pParse->pVdbe;
assert( v!=0 );
if( iBase<0 ) iBase = pParse->nTab;
iDataCur = iBase++;
From 289a0c849b7d0a2242089d4a06cfb5a16284a40d Mon Sep 17 00:00:00 2001
From: drh
Date: Sat, 15 Aug 2020 22:23:00 +0000
Subject: [PATCH 017/169] Remove more unnecessary sqlite3GetVdbe() calls,
replacing them with assert()s.
FossilOrigin-Name: b7dc932197665f0ebde3ffb8f0785c22da07ce307cfd5f0eab69e86e4b38fcde
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/build.c | 6 ++++--
src/insert.c | 3 ++-
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/manifest b/manifest
index 444664d2aa..211f1eb851 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\sunnecessary\scalls\sto\sthe\ssqlite3GetVdbe()\sroutine.\s\sAdd\sassert()\nstatements\sto\sprove\seach\scall\sis\sunnecessary.
-D 2020-08-15T21:55:14.374
+C Remove\smore\sunnecessary\ssqlite3GetVdbe()\scalls,\sreplacing\sthem\swith\sassert()s.
+D 2020-08-15T22:23:00.138
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 1439fd9b45d4d1883c53752daef42af489adaa1a1508fa39dedbc9c80ea21a2f
F src/btree.h 7af72bbb4863c331c8f6753277ab40ee67d2a2125a63256d5c25489722ec162b
F src/btreeInt.h 83166f6daeb91062b6ae9ee6247b3ad07e40eba58f3c05ba9e8dedad4ab1ea38
-F src/build.c 20637935b1e340c91c1f977f0806a647cf37d4404f0dc9d85a0ada2a97321e6c
+F src/build.c bcede98b9ce38cd1cc3c15008e4d5f38ea85ecb2db72f57bd94ff69489b8aa53
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c e98518d2d3d4029a13c805e07313fb60c877be56db76e90dd5f3af73085d0ce6
@@ -496,7 +496,7 @@ F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
F src/hash.h 9d56a9079d523b648774c1784b74b89bd93fac7b365210157482e4319a468f38
F src/hwtime.h cb1d7e3e1ed94b7aa6fde95ae2c2daccc3df826be26fc9ed7fd90d1750ae6144
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
-F src/insert.c 38abe677d1fbcdf30e58f335a85aa1f6cab131335128a4b32e069c5c784f961d
+F src/insert.c 1103270dfc1a94d1ca69f36dc3e021a335459583195e4b9e5a4d6e3c840279ba
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
F src/main.c 09580279145f27f3db206ef44dcb3a8875a42644230f79c7e54aff35e71668f0
@@ -1879,7 +1879,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 e51ecadcbdef5ce6e41d68412aee70aa4a1416c850358a6fa7e9a1ab443e719d
-R efbcf9be3b3a890db43b8ca127b0dc88
+P 86d3790caf92e9cb7a9aaaa110f309b4b6945ac30cfd53fc3e5aa1ec3075ada5
+R 08903bc4cf7f30ac4fc0a04098330b99
U drh
-Z e7716cf2731eceb23b87ee8b9b7f7346
+Z 4655d123e4bb127f684af23738d71086
diff --git a/manifest.uuid b/manifest.uuid
index c8a17a0977..62ccbc2996 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-86d3790caf92e9cb7a9aaaa110f309b4b6945ac30cfd53fc3e5aa1ec3075ada5
\ No newline at end of file
+b7dc932197665f0ebde3ffb8f0785c22da07ce307cfd5f0eab69e86e4b38fcde
\ No newline at end of file
diff --git a/src/build.c b/src/build.c
index 5d71b96690..a9ae0e008e 100644
--- a/src/build.c
+++ b/src/build.c
@@ -91,7 +91,7 @@ void sqlite3TableLock(
static void codeTableLocks(Parse *pParse){
int i;
Vdbe *pVdbe = pParse->pVdbe;
- assert( pVdbe!=0 ); /* sqlite3GetVdbe cannot fail: VDBE already allocated */
+ assert( pVdbe!=0 );
for(i=0; inTableLock; i++){
TableLock *p = &pParse->aTableLock[i];
@@ -4829,7 +4829,9 @@ void sqlite3HaltConstraint(
i8 p4type, /* P4_STATIC or P4_TRANSIENT */
u8 p5Errmsg /* P5_ErrMsg type */
){
- Vdbe *v = sqlite3GetVdbe(pParse);
+ Vdbe *v;
+ assert( pParse->pVdbe!=0 );
+ v = sqlite3GetVdbe(pParse);
assert( (errCode&0xff)==SQLITE_CONSTRAINT || pParse->nested );
if( onError==OE_Abort ){
sqlite3MayAbort(pParse);
diff --git a/src/insert.c b/src/insert.c
index a4759ea766..7c89f33775 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -32,7 +32,8 @@ void sqlite3OpenTable(
){
Vdbe *v;
assert( !IsVirtual(pTab) );
- v = sqlite3GetVdbe(pParse);
+ assert( pParse->pVdbe!=0 );
+ v = pParse->pVdbe;
assert( opcode==OP_OpenWrite || opcode==OP_OpenRead );
sqlite3TableLock(pParse, iDb, pTab->tnum,
(opcode==OP_OpenWrite)?1:0, pTab->zName);
From 45d827cb6aaf9c2ac4392a4781ca7010be1f69d2 Mon Sep 17 00:00:00 2001
From: drh
Date: Sat, 15 Aug 2020 23:48:22 +0000
Subject: [PATCH 018/169] Optimization of the sqlite3SrcListDelete() routine.
FossilOrigin-Name: 1b4acd1ac4a8d24f8804c6d0770f5b0022f569d51742b6954b26e525f04d38ca
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/build.c | 10 +++++-----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/manifest b/manifest
index 211f1eb851..6d5fca0130 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\smore\sunnecessary\ssqlite3GetVdbe()\scalls,\sreplacing\sthem\swith\sassert()s.
-D 2020-08-15T22:23:00.138
+C Optimization\sof\sthe\ssqlite3SrcListDelete()\sroutine.
+D 2020-08-15T23:48:22.883
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 1439fd9b45d4d1883c53752daef42af489adaa1a1508fa39dedbc9c80ea21a2f
F src/btree.h 7af72bbb4863c331c8f6753277ab40ee67d2a2125a63256d5c25489722ec162b
F src/btreeInt.h 83166f6daeb91062b6ae9ee6247b3ad07e40eba58f3c05ba9e8dedad4ab1ea38
-F src/build.c bcede98b9ce38cd1cc3c15008e4d5f38ea85ecb2db72f57bd94ff69489b8aa53
+F src/build.c a1aa0478c86a05b5bd7e3faa4aad6beeb2660be91261e479891a13ce1389bd7e
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c e98518d2d3d4029a13c805e07313fb60c877be56db76e90dd5f3af73085d0ce6
@@ -1879,7 +1879,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 86d3790caf92e9cb7a9aaaa110f309b4b6945ac30cfd53fc3e5aa1ec3075ada5
-R 08903bc4cf7f30ac4fc0a04098330b99
+P b7dc932197665f0ebde3ffb8f0785c22da07ce307cfd5f0eab69e86e4b38fcde
+R d589aa20ebd35240a2738ae9990fa667
U drh
-Z 4655d123e4bb127f684af23738d71086
+Z 740ca2f6298d249a7d9d96f5ff6338d0
diff --git a/manifest.uuid b/manifest.uuid
index 62ccbc2996..2f56c8904a 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-b7dc932197665f0ebde3ffb8f0785c22da07ce307cfd5f0eab69e86e4b38fcde
\ No newline at end of file
+1b4acd1ac4a8d24f8804c6d0770f5b0022f569d51742b6954b26e525f04d38ca
\ No newline at end of file
diff --git a/src/build.c b/src/build.c
index a9ae0e008e..2b6342ba9b 100644
--- a/src/build.c
+++ b/src/build.c
@@ -4464,15 +4464,15 @@ void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
struct SrcList_item *pItem;
if( pList==0 ) return;
for(pItem=pList->a, i=0; inSrc; i++, pItem++){
- sqlite3DbFree(db, pItem->zDatabase);
+ if( pItem->zDatabase ) sqlite3DbFreeNN(db, pItem->zDatabase);
sqlite3DbFree(db, pItem->zName);
- sqlite3DbFree(db, pItem->zAlias);
+ if( pItem->zAlias ) sqlite3DbFreeNN(db, pItem->zAlias);
if( pItem->fg.isIndexedBy ) sqlite3DbFree(db, pItem->u1.zIndexedBy);
if( pItem->fg.isTabFunc ) sqlite3ExprListDelete(db, pItem->u1.pFuncArg);
sqlite3DeleteTable(db, pItem->pTab);
- sqlite3SelectDelete(db, pItem->pSelect);
- sqlite3ExprDelete(db, pItem->pOn);
- sqlite3IdListDelete(db, pItem->pUsing);
+ if( pItem->pSelect ) sqlite3SelectDelete(db, pItem->pSelect);
+ if( pItem->pOn ) sqlite3ExprDelete(db, pItem->pOn);
+ if( pItem->pUsing ) sqlite3IdListDelete(db, pItem->pUsing);
}
sqlite3DbFreeNN(db, pList);
}
From 1d8f892a31e750f3e7247c74e07acfd4cadba9e8 Mon Sep 17 00:00:00 2001
From: drh
Date: Sun, 16 Aug 2020 00:30:44 +0000
Subject: [PATCH 019/169] Optimization to sqlite3BeginWriteOperation().
FossilOrigin-Name: 2173d4c6e3addc75964508f2fc8e42755376b3bc285286fa90df4831a6fa280b
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/build.c | 19 +++++++++++--------
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/manifest b/manifest
index 6d5fca0130..b19c0368c2 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Optimization\sof\sthe\ssqlite3SrcListDelete()\sroutine.
-D 2020-08-15T23:48:22.883
+C Optimization\sto\ssqlite3BeginWriteOperation().
+D 2020-08-16T00:30:44.476
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 1439fd9b45d4d1883c53752daef42af489adaa1a1508fa39dedbc9c80ea21a2f
F src/btree.h 7af72bbb4863c331c8f6753277ab40ee67d2a2125a63256d5c25489722ec162b
F src/btreeInt.h 83166f6daeb91062b6ae9ee6247b3ad07e40eba58f3c05ba9e8dedad4ab1ea38
-F src/build.c a1aa0478c86a05b5bd7e3faa4aad6beeb2660be91261e479891a13ce1389bd7e
+F src/build.c a80bc79f0be20185e2005b74e9a23f8abb8fbb3cc54ed769a21865f79d507d90
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c e98518d2d3d4029a13c805e07313fb60c877be56db76e90dd5f3af73085d0ce6
@@ -1879,7 +1879,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 b7dc932197665f0ebde3ffb8f0785c22da07ce307cfd5f0eab69e86e4b38fcde
-R d589aa20ebd35240a2738ae9990fa667
+P 1b4acd1ac4a8d24f8804c6d0770f5b0022f569d51742b6954b26e525f04d38ca
+R eb7d2eb9837b02d692f86ab11127e1d5
U drh
-Z 740ca2f6298d249a7d9d96f5ff6338d0
+Z 4f2f05a1f836926720a2c2ef3cbb9300
diff --git a/manifest.uuid b/manifest.uuid
index 2f56c8904a..9aa575c482 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-1b4acd1ac4a8d24f8804c6d0770f5b0022f569d51742b6954b26e525f04d38ca
\ No newline at end of file
+2173d4c6e3addc75964508f2fc8e42755376b3bc285286fa90df4831a6fa280b
\ No newline at end of file
diff --git a/src/build.c b/src/build.c
index 2b6342ba9b..d0086c3c0c 100644
--- a/src/build.c
+++ b/src/build.c
@@ -53,7 +53,7 @@ void sqlite3TableLock(
u8 isWriteLock, /* True for a write lock */
const char *zName /* Name of the table to be locked */
){
- Parse *pToplevel = sqlite3ParseToplevel(pParse);
+ Parse *pToplevel;
int i;
int nBytes;
TableLock *p;
@@ -61,6 +61,7 @@ void sqlite3TableLock(
if( iDb==1 ) return;
if( !sqlite3BtreeSharable(pParse->db->aDb[iDb].pBt) ) return;
+ pToplevel = sqlite3ParseToplevel(pParse);
for(i=0; inTableLock; i++){
p = &pToplevel->aTableLock[i];
if( p->iDb==iDb && p->iTab==iTab ){
@@ -4733,13 +4734,11 @@ int sqlite3OpenTempDatabase(Parse *pParse){
** will occur at the end of the top-level VDBE and will be generated
** later, by sqlite3FinishCoding().
*/
-void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
- Parse *pToplevel = sqlite3ParseToplevel(pParse);
-
- assert( iDb>=0 && iDbdb->nDb );
- assert( pParse->db->aDb[iDb].pBt!=0 || iDb==1 );
+static void sqlite3CodeVerifySchemaAtToplevel(Parse *pToplevel, int iDb){
+ assert( iDb>=0 && iDbdb->nDb );
+ assert( pToplevel->db->aDb[iDb].pBt!=0 || iDb==1 );
assert( iDbdb, iDb, 0) );
+ assert( sqlite3SchemaMutexHeld(pToplevel->db, iDb, 0) );
if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){
DbMaskSet(pToplevel->cookieMask, iDb);
if( !OMIT_TEMPDB && iDb==1 ){
@@ -4747,6 +4746,10 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
}
}
}
+void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
+ sqlite3CodeVerifySchemaAtToplevel(sqlite3ParseToplevel(pParse), iDb);
+}
+
/*
** If argument zDb is NULL, then call sqlite3CodeVerifySchema() for each
@@ -4778,7 +4781,7 @@ void sqlite3CodeVerifyNamedSchema(Parse *pParse, const char *zDb){
*/
void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){
Parse *pToplevel = sqlite3ParseToplevel(pParse);
- sqlite3CodeVerifySchema(pParse, iDb);
+ sqlite3CodeVerifySchemaAtToplevel(pToplevel, iDb);
DbMaskSet(pToplevel->writeMask, iDb);
pToplevel->isMultiWrite |= setStatement;
}
From 9191c702fcd7802a6155fbb3134a993ef036f7a5 Mon Sep 17 00:00:00 2001
From: drh
Date: Mon, 17 Aug 2020 09:11:21 +0000
Subject: [PATCH 020/169] Fix the -quote option on the CLI to set the correct
column separator.
FossilOrigin-Name: c778f8295c3c9b6cd6107b33fd7664ae75c97840fc974c9f971755a523f185c4
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/shell.c.in | 2 ++
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/manifest b/manifest
index b19c0368c2..2ed59d4629 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Optimization\sto\ssqlite3BeginWriteOperation().
-D 2020-08-16T00:30:44.476
+C Fix\sthe\s-quote\soption\son\sthe\sCLI\sto\sset\sthe\scorrect\scolumn\sseparator.
+D 2020-08-17T09:11:21.359
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -536,7 +536,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c d74715aceed2a8f493ba244d535646fa93132042a4400a29dfd26ec841514048
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 510fdf819f218be3dac2683d3eaaf64e5080f548061a4dd12205590beda976bb
-F src/shell.c.in b9b819feede7b85585ab0826490a352e04e2ee46e8132c92597d29972b2be1d7
+F src/shell.c.in b6d5d6ebeb8903e4946f23f0886f24133e0a9b6ecbc4cf90ede422ba297e73d5
F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd091f
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1879,7 +1879,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 1b4acd1ac4a8d24f8804c6d0770f5b0022f569d51742b6954b26e525f04d38ca
-R eb7d2eb9837b02d692f86ab11127e1d5
+P 2173d4c6e3addc75964508f2fc8e42755376b3bc285286fa90df4831a6fa280b
+R 442f1dbe4ea4377ad5ec4785729f8731
U drh
-Z 4f2f05a1f836926720a2c2ef3cbb9300
+Z 385eef9b5efbc0b41b1aec1e03dd9010
diff --git a/manifest.uuid b/manifest.uuid
index 9aa575c482..16fa0e8674 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-2173d4c6e3addc75964508f2fc8e42755376b3bc285286fa90df4831a6fa280b
\ No newline at end of file
+c778f8295c3c9b6cd6107b33fd7664ae75c97840fc974c9f971755a523f185c4
\ No newline at end of file
diff --git a/src/shell.c.in b/src/shell.c.in
index 894462acba..8d238d4ab6 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -11015,6 +11015,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
data.mode = MODE_List;
}else if( strcmp(z,"-quote")==0 ){
data.mode = MODE_Quote;
+ sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator, SEP_Comma);
+ sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, SEP_Row);
}else if( strcmp(z,"-line")==0 ){
data.mode = MODE_Line;
}else if( strcmp(z,"-column")==0 ){
From fce445b8fa02ded3850c30a08d2519dd64e102ba Mon Sep 17 00:00:00 2001
From: dan
Date: Wed, 19 Aug 2020 15:21:52 +0000
Subject: [PATCH 021/169] Fix a problem in test file bigmmap.test.
FossilOrigin-Name: d8e47382160e98be646ce3ba568578493088d1bb11d513ded3e00b576fb07f06
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
test/bigmmap.test | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index 2ed59d4629..02cb8df2a4 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\s-quote\soption\son\sthe\sCLI\sto\sset\sthe\scorrect\scolumn\sseparator.
-D 2020-08-17T09:11:21.359
+C Fix\sa\sproblem\sin\stest\sfile\sbigmmap.test.
+D 2020-08-19T15:21:52.251
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -709,7 +709,7 @@ F test/bestindex7.test f36ada201973d3022cf7afffffe08de9e58341996020e7a2df9a1d2f2
F test/between.test 68137a6e941c221417c15b6fe2d55f27bb1b6ab48bdf9e2aa51efdd85bc53802
F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
-F test/bigmmap.test 31dad31573638bd32de866cdefd11843f75685be4ba6aec1a47918f098f1899b
+F test/bigmmap.test e906cf9729d7c362270ffe9fa6471f4c39c28ba83f0f77fb795e1b4d38a22ba0
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
F test/bigsort.test 8299fa9298f4f1e02fc7d2712e8b77d6cd60e5a2
F test/bind.test 1e136709b306f7ed3192d349c2930d89df6ab621654ad6f1a72381d3fe76f483
@@ -1879,7 +1879,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 2173d4c6e3addc75964508f2fc8e42755376b3bc285286fa90df4831a6fa280b
-R 442f1dbe4ea4377ad5ec4785729f8731
-U drh
-Z 385eef9b5efbc0b41b1aec1e03dd9010
+P c778f8295c3c9b6cd6107b33fd7664ae75c97840fc974c9f971755a523f185c4
+R 49f56307e7f17223c2b06ac52ce2a1fc
+U dan
+Z e95c058045a0ba4e119e5f1f2eb81bf1
diff --git a/manifest.uuid b/manifest.uuid
index 16fa0e8674..d7c1a31d55 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-c778f8295c3c9b6cd6107b33fd7664ae75c97840fc974c9f971755a523f185c4
\ No newline at end of file
+d8e47382160e98be646ce3ba568578493088d1bb11d513ded3e00b576fb07f06
\ No newline at end of file
diff --git a/test/bigmmap.test b/test/bigmmap.test
index 7da1df247e..62e035b05f 100644
--- a/test/bigmmap.test
+++ b/test/bigmmap.test
@@ -95,7 +95,7 @@ for {set i 0} {$i < 9} {incr i} {
" [string map {"\n " "\n"} "
QUERY PLAN
|--SCAN TABLE t$t AS o USING COVERING INDEX sqlite_autoindex_t${t}_1
- `--CORRELATED SCALAR SUBQUERY
+ `--CORRELATED SCALAR SUBQUERY xxxxxx
`--SEARCH TABLE t$t AS i USING INTEGER PRIMARY KEY (rowid=?)
"]
}
From 1d42e619acb77717cbf318e6fb473b6a756e9160 Mon Sep 17 00:00:00 2001
From: dan
Date: Wed, 19 Aug 2020 15:24:19 +0000
Subject: [PATCH 022/169] Update releasetest_data.tcl so that the "Fast-One"
configuration runs bigmmap.test as part of release testing.
FossilOrigin-Name: a0aa35aaa5694a96638a7c7b1cd69c7523750cbe95831a13c1ee5a6d48256b76
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
test/releasetest_data.tcl | 1 +
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/manifest b/manifest
index 02cb8df2a4..6cd0f2a5c0 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\sin\stest\sfile\sbigmmap.test.
-D 2020-08-19T15:21:52.251
+C Update\sreleasetest_data.tcl\sso\sthat\sthe\s"Fast-One"\sconfiguration\sruns\sbigmmap.test\sas\spart\sof\srelease\stesting.
+D 2020-08-19T15:24:19.261
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1272,7 +1272,7 @@ F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c
F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d
F test/releasetest.tcl fb76d8fcc95ac29d6356cd9e52b726ab9e43a24082897618dfbcb7c2b0049153 x
-F test/releasetest_data.tcl 9fbb722e2a7c4c8377533f63a66c2de64b0dba982b6dfa6fb434da12518a03a7
+F test/releasetest_data.tcl 4d251c430b67fa0d9422fa8214df54546d3aff55dfcc9124503f9e26a576c8fe
F test/resetdb.test 8062cf10a09d8c048f8de7711e94571c38b38168db0e5877ba7561789e5eeb2b
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa
@@ -1879,7 +1879,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 c778f8295c3c9b6cd6107b33fd7664ae75c97840fc974c9f971755a523f185c4
-R 49f56307e7f17223c2b06ac52ce2a1fc
+P d8e47382160e98be646ce3ba568578493088d1bb11d513ded3e00b576fb07f06
+R ea1afde48f0d02557391a4047adf2310
U dan
-Z e95c058045a0ba4e119e5f1f2eb81bf1
+Z d5829a9d86564dfb4bfa4de08f611888
diff --git a/manifest.uuid b/manifest.uuid
index d7c1a31d55..aad562bbea 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-d8e47382160e98be646ce3ba568578493088d1bb11d513ded3e00b576fb07f06
\ No newline at end of file
+a0aa35aaa5694a96638a7c7b1cd69c7523750cbe95831a13c1ee5a6d48256b76
\ No newline at end of file
diff --git a/test/releasetest_data.tcl b/test/releasetest_data.tcl
index 50de1cc71f..466de1aab4 100644
--- a/test/releasetest_data.tcl
+++ b/test/releasetest_data.tcl
@@ -143,6 +143,7 @@ array set ::Configs [strip_comments {
-DSQLITE_ENABLE_STAT4
-DSQLITE_ENABLE_RBU
-DSQLITE_MAX_ATTACHED=125
+ -DSQLITE_MAX_MMAP_SIZE=12884901888
-DLONGDOUBLE_TYPE=double
--enable-session
}
From 46fe138d98664b30ada114b1f76b52e95d00575c Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 19 Aug 2020 23:32:06 +0000
Subject: [PATCH 023/169] Do not skip over TK_IF_NULL_ROW operators when
bypassing TK_COLLATE operators. Fix to check-in [ac31edd3eeafcef4] which was
itself a fix for ticket [45f4bf4eb4ffd788].
FossilOrigin-Name: 871f2ddcfbb9196dbd851a350e3471ee6d242d86bbd755201f7e2406fce3ac55
---
manifest | 20 ++++++++++----------
manifest.uuid | 2 +-
src/expr.c | 6 +++---
src/select.c | 2 +-
src/sqliteInt.h | 2 +-
test/join2.test | 17 ++++++++++++++++-
6 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/manifest b/manifest
index 6cd0f2a5c0..5c133b0db5 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sreleasetest_data.tcl\sso\sthat\sthe\s"Fast-One"\sconfiguration\sruns\sbigmmap.test\sas\spart\sof\srelease\stesting.
-D 2020-08-19T15:24:19.261
+C Do\snot\sskip\sover\sTK_IF_NULL_ROW\soperators\swhen\sbypassing\sTK_COLLATE\soperators.\nFix\sto\scheck-in\s[ac31edd3eeafcef4]\swhich\swas\sitself\sa\sfix\sfor\sticket\n[45f4bf4eb4ffd788].
+D 2020-08-19T23:32:06.595
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -487,7 +487,7 @@ F src/date.c dace306a10d9b02ee553d454c8e1cf8d3c9b932e137738a6b15b90253a9bfc10
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
F src/delete.c a2a603ab07cced8560065b0e2c4c9c842f2c5a2fd43d87355f95eb53bae7fe21
-F src/expr.c 58c06940d964c2cf455b979cf66a648499d294a5ee6dadcaeaed447257c1dc75
+F src/expr.c 616244b0f99ca50320b44c547972ed8de7e92c2088b300810b9ac804c40fbc9c
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 83372403298e6a7dd989a47aaacdbaa5b4307b5199dbd56e07d4896066b3de72
F src/func.c 2333eb4277f55a5efdc12ef754e7d7ec9105d257b2fd00301d23ce1e8fa67dc0
@@ -535,12 +535,12 @@ F src/printf.c 9efcd4e984f22bcccb1ded37a1178cac98f6e3a0534e1e0629f64899971f8838
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c d74715aceed2a8f493ba244d535646fa93132042a4400a29dfd26ec841514048
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
-F src/select.c 510fdf819f218be3dac2683d3eaaf64e5080f548061a4dd12205590beda976bb
+F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
F src/shell.c.in b6d5d6ebeb8903e4946f23f0886f24133e0a9b6ecbc4cf90ede422ba297e73d5
F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd091f
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
-F src/sqliteInt.h 86ad0f9164cbadb2ba9598cc6cf5b32bdb47b343c0da5ca62f3d73b60be55b65
+F src/sqliteInt.h 7dd1f3a93e801c90cf108149d041c6cc32d3e9503d66aa415455dae1614b6b53
F src/sqliteLimit.h 95cb8479ca459496d9c1c6a9f76b38aee12203a56ce1092fe13e50ae2454c032
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -1103,7 +1103,7 @@ F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b
F test/istrue.test 06f92ea38750fa74df7dbbe6920205251c2310861fbbe23a3adfa918a2e2ba74
F test/join.test bca044589e94bb466e4c1e91fb6fecdc3f3326ca6b3f590f555f1958156eb321
-F test/join2.test 7d24d095ab88d3910228d53a3b548b7baf2e0e7d8aac6731a273e300e1b34b61
+F test/join2.test 21fc30e54ab35ed66bf51b89cec18729205497f5cc43c83bc042f96a73721593
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/join5.test 3a96dc62f0b45402d7207e22d1993fe0c2fce1c57644a11439891dd62b990eb7
@@ -1879,7 +1879,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 d8e47382160e98be646ce3ba568578493088d1bb11d513ded3e00b576fb07f06
-R ea1afde48f0d02557391a4047adf2310
-U dan
-Z d5829a9d86564dfb4bfa4de08f611888
+P a0aa35aaa5694a96638a7c7b1cd69c7523750cbe95831a13c1ee5a6d48256b76
+R 75dc1e0cc2548901d96acdc048327264
+U drh
+Z 82ae660e681a73fcc0f28cd7c0e29f86
diff --git a/manifest.uuid b/manifest.uuid
index aad562bbea..01783fafbc 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-a0aa35aaa5694a96638a7c7b1cd69c7523750cbe95831a13c1ee5a6d48256b76
\ No newline at end of file
+871f2ddcfbb9196dbd851a350e3471ee6d242d86bbd755201f7e2406fce3ac55
\ No newline at end of file
diff --git a/src/expr.c b/src/expr.c
index b64ea28bf5..244412b384 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -44,7 +44,7 @@ char sqlite3TableColumnAffinity(Table *pTab, int iCol){
*/
char sqlite3ExprAffinity(const Expr *pExpr){
int op;
- while( ExprHasProperty(pExpr, EP_Skip) ){
+ while( ExprHasProperty(pExpr, EP_Skip|EP_IfNullRow) ){
assert( pExpr->op==TK_COLLATE || pExpr->op==TK_IF_NULL_ROW );
pExpr = pExpr->pLeft;
assert( pExpr!=0 );
@@ -115,7 +115,7 @@ Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){
*/
Expr *sqlite3ExprSkipCollate(Expr *pExpr){
while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){
- assert( pExpr->op==TK_COLLATE || pExpr->op==TK_IF_NULL_ROW );
+ assert( pExpr->op==TK_COLLATE );
pExpr = pExpr->pLeft;
}
return pExpr;
@@ -134,7 +134,7 @@ Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){
assert( pExpr->op==TK_FUNCTION );
pExpr = pExpr->x.pList->a[0].pExpr;
}else{
- assert( pExpr->op==TK_COLLATE || pExpr->op==TK_IF_NULL_ROW );
+ assert( pExpr->op==TK_COLLATE );
pExpr = pExpr->pLeft;
}
}
diff --git a/src/select.c b/src/select.c
index 8b1fae75a5..9568dbadc9 100644
--- a/src/select.c
+++ b/src/select.c
@@ -3506,7 +3506,7 @@ static Expr *substExpr(
ifNullRow.op = TK_IF_NULL_ROW;
ifNullRow.pLeft = pCopy;
ifNullRow.iTable = pSubst->iNewTable;
- ifNullRow.flags = EP_Skip;
+ ifNullRow.flags = EP_IfNullRow;
pCopy = &ifNullRow;
}
testcase( ExprHasProperty(pCopy, EP_Subquery) );
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index a5d108b6c7..f2c4f63c0d 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2715,7 +2715,7 @@ struct Expr {
#define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */
#define EP_Win 0x008000 /* Contains window functions */
#define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */
- /* 0x020000 // available for reuse */
+#define EP_IfNullRow 0x020000 /* The TK_IF_NULL_ROW opcode */
#define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */
#define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */
#define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */
diff --git a/test/join2.test b/test/join2.test
index 82d597c584..f004fda071 100644
--- a/test/join2.test
+++ b/test/join2.test
@@ -294,7 +294,10 @@ do_execsql_test 8.1 {
}
#-------------------------------------------------------------------------
-# Ticket [45f4bf4eb].
+# Ticket [45f4bf4eb] reported by Manuel Rigger (2020-04-25)
+#
+# Follow up error reported by Eric Speckman on the SQLite forum
+# https://sqlite.org/forum/info/c49496d24d35bd7c (2020-08-19)
#
reset_db
do_execsql_test 9.0 {
@@ -324,5 +327,17 @@ do_execsql_test 9.5 {
UNION SELECT 0,0 WHERE 0;
} {0 0}
+do_execsql_test 9.10 {
+ CREATE TABLE t1 (aaa);
+ INSERT INTO t1 VALUES(23456);
+ CREATE TABLE t2(bbb);
+ CREATE VIEW v2(ccc) AS SELECT bbb IS 1234 FROM t2;
+ SELECT ccc, ccc IS NULL AS ddd FROM t1 LEFT JOIN v2;
+} {{} 1}
+optimization_control db query-flattener 0
+do_execsql_test 9.11 {
+ SELECT ccc, ccc IS NULL AS ddd FROM t1 LEFT JOIN v2;
+} {{} 1}
+
finish_test
From 14f38b3d0a069474b716296846cbffb6fadfd4f9 Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 19 Aug 2020 23:51:54 +0000
Subject: [PATCH 024/169] Try to make SQLite easier to compiler for Mac
Catalyst. See [https://sqlite.org/forum/forumpost/803387a1c5|forum post
803387a1c5].
FossilOrigin-Name: e1595a20d71e61957944cc2b634578968cda8fba08a1f1e75edba20dc9c6080b
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/os_unix.c | 3 ++-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 5c133b0db5..077574e6a1 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Do\snot\sskip\sover\sTK_IF_NULL_ROW\soperators\swhen\sbypassing\sTK_COLLATE\soperators.\nFix\sto\scheck-in\s[ac31edd3eeafcef4]\swhich\swas\sitself\sa\sfix\sfor\sticket\n[45f4bf4eb4ffd788].
-D 2020-08-19T23:32:06.595
+C Try\sto\smake\sSQLite\seasier\sto\scompiler\sfor\sMac\sCatalyst.\sSee\s\n[https://sqlite.org/forum/forumpost/803387a1c5|forum\spost\s803387a1c5].
+D 2020-08-19T23:51:54.209
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -519,7 +519,7 @@ F src/os.c 80e4cf3e5da06be03ca641661e331ce60eeeeabf0d7354dbb1c0e166d0eedbbe
F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c 9b1b860163fd2d4d7679b5260d384d1a9f88ef917a90f28963eca8acd472d8c8
+F src/os_unix.c 13553fb5ffbe8c0e60f5d7f553667560b7dece9e31cdfcf8b57b33092a11f226
F src/os_win.c a2149ff0a85c1c3f9cc102a46c673ce87e992396ba3411bfb53db66813b32f1d
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
@@ -1879,7 +1879,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 a0aa35aaa5694a96638a7c7b1cd69c7523750cbe95831a13c1ee5a6d48256b76
-R 75dc1e0cc2548901d96acdc048327264
+P 871f2ddcfbb9196dbd851a350e3471ee6d242d86bbd755201f7e2406fce3ac55
+R da5d9aff2fd6b1f37ad37120104d1d1b
U drh
-Z 82ae660e681a73fcc0f28cd7c0e29f86
+Z f2253a790427c20b66ccdbd6a8f3418a
diff --git a/manifest.uuid b/manifest.uuid
index 01783fafbc..37cd338d28 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-871f2ddcfbb9196dbd851a350e3471ee6d242d86bbd755201f7e2406fce3ac55
\ No newline at end of file
+e1595a20d71e61957944cc2b634578968cda8fba08a1f1e75edba20dc9c6080b
\ No newline at end of file
diff --git a/src/os_unix.c b/src/os_unix.c
index fc54153333..c9b59f229a 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -122,7 +122,8 @@
# if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \
(__IPHONE_OS_VERSION_MIN_REQUIRED > 2000))
# if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \
- && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0))
+ && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0))\
+ && (!defined(TARGET_OS_MACCATALYST) || (TARGET_OS_MACCATALYST==0))
# undef HAVE_GETHOSTUUID
# define HAVE_GETHOSTUUID 1
# else
From 7b14b990d0fbf4b28a13095702d3d81684da15ec Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 20 Aug 2020 11:03:33 +0000
Subject: [PATCH 025/169] Avoid a buffer overrun in test code that could occur
if certain test functions were passed a hex-string containing an odd number
of digits.
FossilOrigin-Name: 3c5e63c22ffbfeb66eb6ee38912d29fad6f2bd4d74b6a25e89bd36bf40eaa661
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/test_hexio.c | 6 +++---
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/manifest b/manifest
index 077574e6a1..6f63a14b78 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Try\sto\smake\sSQLite\seasier\sto\scompiler\sfor\sMac\sCatalyst.\sSee\s\n[https://sqlite.org/forum/forumpost/803387a1c5|forum\spost\s803387a1c5].
-D 2020-08-19T23:51:54.209
+C Avoid\sa\sbuffer\soverrun\sin\stest\scode\sthat\scould\soccur\sif\scertain\stest\sfunctions\swere\spassed\sa\shex-string\scontaining\san\sodd\snumber\sof\sdigits.
+D 2020-08-20T11:03:33.797
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -566,7 +566,7 @@ F src/test_demovfs.c 86142ba864d4297d54c5b2e972e74f3141ae4b30f05b3a95824184ed2d3
F src/test_devsym.c 6109b45c3db3ef7b002320947ed448c027356ab8b885156ff535fd8684d4a571
F src/test_fs.c ba1e1dc18fd3159fdba0b9c4256f14032159785320dfbd6776eb9973cb75d480
F src/test_func.c 181f992e5495644434c4f0e3cc72362a78c295eb2cf3ff4d02498b8bde7aa276
-F src/test_hexio.c d170d0e1a6431afdeac086a250d2595078288c2257615d37949355361399bcaa
+F src/test_hexio.c 9478e56a0f08e07841a014a93b20e4ba2709ab56d039d1ca8020e26846aa19bd
F src/test_init.c 4413c211a94b62157ca4c145b3f27c497f03c664
F src/test_intarray.c 39b4181662a0f33a427748d87218e7578d913e683dc27eab7098bb41617cac71
F src/test_intarray.h d57ae92f420cda25e22790dac474d60961bd0c500cbaa3338a05152d4a669ef7
@@ -1879,7 +1879,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 871f2ddcfbb9196dbd851a350e3471ee6d242d86bbd755201f7e2406fce3ac55
-R da5d9aff2fd6b1f37ad37120104d1d1b
-U drh
-Z f2253a790427c20b66ccdbd6a8f3418a
+P e1595a20d71e61957944cc2b634578968cda8fba08a1f1e75edba20dc9c6080b
+R 6913aaf82b6ea309e44c16e0d51aa7e8
+U dan
+Z ea10fc98bd455a7905a78ecc0625e60d
diff --git a/manifest.uuid b/manifest.uuid
index 37cd338d28..27891fa64e 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-e1595a20d71e61957944cc2b634578968cda8fba08a1f1e75edba20dc9c6080b
\ No newline at end of file
+3c5e63c22ffbfeb66eb6ee38912d29fad6f2bd4d74b6a25e89bd36bf40eaa661
\ No newline at end of file
diff --git a/src/test_hexio.c b/src/test_hexio.c
index 78a5ba2d0c..61a41d5b1c 100644
--- a/src/test_hexio.c
+++ b/src/test_hexio.c
@@ -168,7 +168,7 @@ static int SQLITE_TCLAPI hexio_write(
if( Tcl_GetIntFromObj(interp, objv[2], &offset) ) return TCL_ERROR;
zFile = Tcl_GetString(objv[1]);
zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[3], &nIn);
- aOut = sqlite3_malloc( nIn/2 );
+ aOut = sqlite3_malloc( 1 + nIn/2 );
if( aOut==0 ){
return TCL_ERROR;
}
@@ -213,7 +213,7 @@ static int SQLITE_TCLAPI hexio_get_int(
return TCL_ERROR;
}
zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[1], &nIn);
- aOut = sqlite3_malloc( nIn/2 );
+ aOut = sqlite3_malloc( 1 + nIn/2 );
if( aOut==0 ){
return TCL_ERROR;
}
@@ -309,7 +309,7 @@ static int SQLITE_TCLAPI utf8_to_utf8(
return TCL_ERROR;
}
zOrig = (unsigned char *)Tcl_GetStringFromObj(objv[1], &n);
- z = sqlite3_malloc( n+3 );
+ z = sqlite3_malloc( n+4 );
n = sqlite3TestHexToBin(zOrig, n, z);
z[n] = 0;
nOut = sqlite3Utf8To8(z);
From 6c3b4b07d13f1cb9047103582381925a01f1a3a2 Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 20 Aug 2020 16:25:26 +0000
Subject: [PATCH 026/169] Fix a crash that could occur in
SQLITE_MAX_EXPR_DEPTH=0 builds when processing SQL containing syntax errors.
FossilOrigin-Name: 5f58dd3a19605b6f49b4364fa29892502eff35f12a7693a8694100e1844711ea
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
src/expr.c | 1 +
src/sqliteLimit.h | 6 +-----
test/releasetest_data.tcl | 6 ++++++
5 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/manifest b/manifest
index 6f63a14b78..a3c13f5bd9 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\sa\sbuffer\soverrun\sin\stest\scode\sthat\scould\soccur\sif\scertain\stest\sfunctions\swere\spassed\sa\shex-string\scontaining\san\sodd\snumber\sof\sdigits.
-D 2020-08-20T11:03:33.797
+C Fix\sa\scrash\sthat\scould\soccur\sin\sSQLITE_MAX_EXPR_DEPTH=0\sbuilds\swhen\sprocessing\sSQL\scontaining\ssyntax\serrors.
+D 2020-08-20T16:25:26.970
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -487,7 +487,7 @@ F src/date.c dace306a10d9b02ee553d454c8e1cf8d3c9b932e137738a6b15b90253a9bfc10
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
F src/delete.c a2a603ab07cced8560065b0e2c4c9c842f2c5a2fd43d87355f95eb53bae7fe21
-F src/expr.c 616244b0f99ca50320b44c547972ed8de7e92c2088b300810b9ac804c40fbc9c
+F src/expr.c 4c8b9c2942adb896b9d1613794bd00cbf98c94e38c41cd5720b78bcdc21a965d
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 83372403298e6a7dd989a47aaacdbaa5b4307b5199dbd56e07d4896066b3de72
F src/func.c 2333eb4277f55a5efdc12ef754e7d7ec9105d257b2fd00301d23ce1e8fa67dc0
@@ -541,7 +541,7 @@ F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd09
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
F src/sqliteInt.h 7dd1f3a93e801c90cf108149d041c6cc32d3e9503d66aa415455dae1614b6b53
-F src/sqliteLimit.h 95cb8479ca459496d9c1c6a9f76b38aee12203a56ce1092fe13e50ae2454c032
+F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 986b6391f02cd9b53c1d688be55899f6ffddeb8e8014cd83c1b73ff912579a71
@@ -1272,7 +1272,7 @@ F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c
F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d
F test/releasetest.tcl fb76d8fcc95ac29d6356cd9e52b726ab9e43a24082897618dfbcb7c2b0049153 x
-F test/releasetest_data.tcl 4d251c430b67fa0d9422fa8214df54546d3aff55dfcc9124503f9e26a576c8fe
+F test/releasetest_data.tcl b9cb30360759b80d92d4ea86b84ebfd8035b97f9078a482deb3cf9d0b2442655
F test/resetdb.test 8062cf10a09d8c048f8de7711e94571c38b38168db0e5877ba7561789e5eeb2b
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa
@@ -1879,7 +1879,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 e1595a20d71e61957944cc2b634578968cda8fba08a1f1e75edba20dc9c6080b
-R 6913aaf82b6ea309e44c16e0d51aa7e8
+P 3c5e63c22ffbfeb66eb6ee38912d29fad6f2bd4d74b6a25e89bd36bf40eaa661
+R 080728499b9753952934be39a06d4044
U dan
-Z ea10fc98bd455a7905a78ecc0625e60d
+Z 6d7beb1b999c7f45f1a0f735822f9196
diff --git a/manifest.uuid b/manifest.uuid
index 27891fa64e..4241f4b5f2 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-3c5e63c22ffbfeb66eb6ee38912d29fad6f2bd4d74b6a25e89bd36bf40eaa661
\ No newline at end of file
+5f58dd3a19605b6f49b4364fa29892502eff35f12a7693a8694100e1844711ea
\ No newline at end of file
diff --git a/src/expr.c b/src/expr.c
index 244412b384..7277bb75de 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -768,6 +768,7 @@ int sqlite3SelectExprHeight(Select *p){
** Expr.flags.
*/
void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){
+ if( pParse->nErr ) return;
if( p && p->x.pList && !ExprHasProperty(p, EP_xIsSelect) ){
p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList);
}
diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h
index a7302575c5..08703cb73a 100644
--- a/src/sqliteLimit.h
+++ b/src/sqliteLimit.h
@@ -60,11 +60,7 @@
** The maximum depth of an expression tree. This is limited to
** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
** want to place more severe limits on the complexity of an
-** expression.
-**
-** A value of 0 used to mean that the limit was not enforced.
-** But that is no longer true. The limit is now strictly enforced
-** at all times.
+** expression. A value of 0 means that there is no limit.
*/
#ifndef SQLITE_MAX_EXPR_DEPTH
# define SQLITE_MAX_EXPR_DEPTH 1000
diff --git a/test/releasetest_data.tcl b/test/releasetest_data.tcl
index 466de1aab4..9692cf47fc 100644
--- a/test/releasetest_data.tcl
+++ b/test/releasetest_data.tcl
@@ -136,6 +136,11 @@ array set ::Configs [strip_comments {
-DSQLITE_MUTATION_TEST
--enable-fts5 --enable-json1
}
+ "Debug-Two" {
+ -DSQLITE_DEFAULT_MEMSTATUS=0
+ -DSQLITE_MAX_EXPR_DEPTH=0
+ --enable-debug
+ }
"Fast-One" {
-O6
-DSQLITE_ENABLE_FTS4=1
@@ -286,6 +291,7 @@ array set ::Platforms [strip_comments {
"Check-Symbols*" checksymbols
"Fast-One" "fuzztest test"
"Debug-One" "mptest test"
+ "Debug-Two" "test"
"Have-Not" test
"Secure-Delete" test
"Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
From 599456f0ab888abf5979654f43ec872354f0a639 Mon Sep 17 00:00:00 2001
From: dan
Date: Mon, 24 Aug 2020 10:52:52 +0000
Subject: [PATCH 027/169] Correctly handle expressions like "x IS (not)
true/false" within the rhs of IN() expressions. Fix for [f3ff1472].
FossilOrigin-Name: 493a25949b9a6d0be82169b597133e491d8be4f4147b6eae135b06c1d810abd3
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/resolve.c | 2 +-
test/in.test | 6 ++++++
4 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index a3c13f5bd9..eeb1d0892d 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\scrash\sthat\scould\soccur\sin\sSQLITE_MAX_EXPR_DEPTH=0\sbuilds\swhen\sprocessing\sSQL\scontaining\ssyntax\serrors.
-D 2020-08-20T16:25:26.970
+C Correctly\shandle\sexpressions\slike\s"x\sIS\s(not)\strue/false"\swithin\sthe\srhs\sof\sIN()\sexpressions.\sFix\sfor\s[f3ff1472].
+D 2020-08-24T10:52:52.642
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -533,7 +533,7 @@ F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
F src/prepare.c 3d5a761d026052bc888d1b803a06dd2bfe245e8e836d4689f927003549148b0f
F src/printf.c 9efcd4e984f22bcccb1ded37a1178cac98f6e3a0534e1e0629f64899971f8838
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
-F src/resolve.c d74715aceed2a8f493ba244d535646fa93132042a4400a29dfd26ec841514048
+F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
F src/shell.c.in b6d5d6ebeb8903e4946f23f0886f24133e0a9b6ecbc4cf90ede422ba297e73d5
@@ -1050,7 +1050,7 @@ F test/hook2.test b9ff3b8c6519fb67f33192f1afe86e7782ee4ac8
F test/icu.test 716a6b89fbabe5cc63e0cd4c260befb08fd7b9d761f04d43669233292f0753b1
F test/ieee754.test b0945d12be7d255f3dfa18e2511b17ca37e0edd2b803231c52d05b86c04ab26e
F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8
-F test/in.test ae4ba0fe3232fdd84ef1090a68c5cd6ccd93f1f8774d5c967dd0c1b301492eed
+F test/in.test 95a704448eaa348300a517df267b37488c854aa0713125f4fa7b6280cfd4ed0f
F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
F test/in4.test 65460600d48933adba4283c6ebd089aae173d16136ab9d01f74c89089090c5a5
@@ -1879,7 +1879,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 3c5e63c22ffbfeb66eb6ee38912d29fad6f2bd4d74b6a25e89bd36bf40eaa661
-R 080728499b9753952934be39a06d4044
+P 5f58dd3a19605b6f49b4364fa29892502eff35f12a7693a8694100e1844711ea
+R e7a4532d833ea3a282e0c879ce028741
U dan
-Z 6d7beb1b999c7f45f1a0f735822f9196
+Z b8cdd5c782cc19b36092e011278ca641
diff --git a/manifest.uuid b/manifest.uuid
index 4241f4b5f2..3bf4a51c56 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5f58dd3a19605b6f49b4364fa29892502eff35f12a7693a8694100e1844711ea
\ No newline at end of file
+493a25949b9a6d0be82169b597133e491d8be4f4147b6eae135b06c1d810abd3
\ No newline at end of file
diff --git a/src/resolve.c b/src/resolve.c
index fcb6f15224..d53428c63e 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -1075,7 +1075,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
assert( !ExprHasProperty(pExpr, EP_Reduced) );
/* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE",
** and "x IS NOT FALSE". */
- if( pRight && pRight->op==TK_ID ){
+ if( pRight && (pRight->op==TK_ID || pRight->op==TK_TRUEFALSE) ){
int rc = resolveExprStep(pWalker, pRight);
if( rc==WRC_Abort ) return WRC_Abort;
if( pRight->op==TK_TRUEFALSE ){
diff --git a/test/in.test b/test/in.test
index a1fe1d2fcc..f09c52f9f7 100644
--- a/test/in.test
+++ b/test/in.test
@@ -791,4 +791,10 @@ do_execsql_test in-19.40 {
PRAGMA integrity_check;
} {ok}
+# Ticket f3ff1472887
+#
+do_execsql_test in-20.1 {
+ SELECT (1 IN (2 IS TRUE));
+} {1}
+
finish_test
From 58d6f633bae0c44edcce64cb2d6bd82d5ce4159f Mon Sep 17 00:00:00 2001
From: drh
Date: Mon, 24 Aug 2020 23:44:27 +0000
Subject: [PATCH 028/169] Reduce the N in the logN term for the sorting cost
associated with computing DISTINCT by B-Tree by half, under the assumption
that the DISTINCT will eliminate about half the rows of output. This is
really a wild guess. But we do not have any better way of estimating what
the row-count reduction due to DISTINCT will actually be.
FossilOrigin-Name: 8787417ec1da8071d84c6ff0d7a90b5fd458ab6baba871327f36bc4e1bceca61
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/where.c | 12 ++++++++++--
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/manifest b/manifest
index eeb1d0892d..4b8bd936e0 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Correctly\shandle\sexpressions\slike\s"x\sIS\s(not)\strue/false"\swithin\sthe\srhs\sof\sIN()\sexpressions.\sFix\sfor\s[f3ff1472].
-D 2020-08-24T10:52:52.642
+C Reduce\sthe\sN\sin\sthe\slogN\sterm\sfor\sthe\ssorting\scost\sassociated\swith\scomputing\nDISTINCT\sby\sB-Tree\sby\shalf,\sunder\sthe\sassumption\sthat\sthe\sDISTINCT\swill\neliminate\sabout\shalf\sthe\srows\sof\soutput.\s\sThis\sis\sreally\sa\swild\sguess.\s\sBut\nwe\sdo\snot\shave\sany\sbetter\sway\sof\sestimating\swhat\sthe\srow-count\sreduction\sdue\nto\sDISTINCT\swill\sactually\sbe.
+D 2020-08-24T23:44:27.235
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -622,7 +622,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 69e770e96fd56cc21608992bf2c6f1f3dc5cf2572d0495c6a643b06c3a679f14
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
-F src/where.c 396ba2c62defd56283ef54a4b221f698f4733fe8fbfca4aa8b1cc4f8c58d12ee
+F src/where.c 23f47e845e304a41d0b221bf67bd170014ae08b673076813fcd945dda1a3d4af
F src/whereInt.h eb8c2847fb464728533777efec1682b3c074224293b2da73513c61a609efbeab
F src/wherecode.c 110fa357bf453e0d30bf5ebb2cc86ea34a3631c39b857f30c228fd325cb53ae7
F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7
@@ -1879,7 +1879,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 5f58dd3a19605b6f49b4364fa29892502eff35f12a7693a8694100e1844711ea
-R e7a4532d833ea3a282e0c879ce028741
-U dan
-Z b8cdd5c782cc19b36092e011278ca641
+P 493a25949b9a6d0be82169b597133e491d8be4f4147b6eae135b06c1d810abd3
+R ddd62187ac7223d5e6ce61819bf672f8
+U drh
+Z 3f2dc6629d15095497f0f8f6b9a935ba
diff --git a/manifest.uuid b/manifest.uuid
index 3bf4a51c56..7544a576c2 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-493a25949b9a6d0be82169b597133e491d8be4f4147b6eae135b06c1d810abd3
\ No newline at end of file
+8787417ec1da8071d84c6ff0d7a90b5fd458ab6baba871327f36bc4e1bceca61
\ No newline at end of file
diff --git a/src/where.c b/src/where.c
index 67116c6698..ce276bf401 100644
--- a/src/where.c
+++ b/src/where.c
@@ -4053,16 +4053,24 @@ static LogEst whereSortingCost(
** cost = (3.0 * N * log(N)) * (Y/X)
**
** The (Y/X) term is implemented using stack variable rScale
- ** below. */
+ ** below.
+ */
LogEst rScale, rSortCost;
assert( nOrderBy>0 && 66==sqlite3LogEst(100) );
rScale = sqlite3LogEst((nOrderBy-nSorted)*100/nOrderBy) - 66;
rSortCost = nRow + rScale + 16;
/* Multiple by log(M) where M is the number of output rows.
- ** Use the LIMIT for M if it is smaller */
+ ** Use the LIMIT for M if it is smaller. Or if this sort is for
+ ** a DISTINT operator, M will be the number of distinct output
+ ** rows, so fudge it downwards a bit.
+ */
if( (pWInfo->wctrlFlags & WHERE_USE_LIMIT)!=0 && pWInfo->iLimitiLimit;
+ }else if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT) ){
+ /* TUNING: In the sort for a DISTINCT operator, assume that the DISTINCT
+ ** reduces the number of output rows by a factor of 2 */
+ if( nRow>10 ) nRow -= 10; assert( 10==sqlite3LogEst(2) );
}
rSortCost += estLog(nRow);
return rSortCost;
From 99744fa4ab7696f090e6fd8615b12e9b7e9792e6 Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 25 Aug 2020 19:09:07 +0000
Subject: [PATCH 029/169] Add support for the sqlite3_txn_state() interface.
FossilOrigin-Name: ad195e3dd89d0f33b50070c18fb8f43c4eb24162515dfdd7c04d9e7d96b902a2
---
manifest | 38 +++++++++++++++++-----------------
manifest.uuid | 2 +-
src/attach.c | 4 +++-
src/backup.c | 8 ++++----
src/btree.c | 15 +++++---------
src/btree.h | 3 +--
src/btreeInt.h | 14 +++++++++++++
src/main.c | 42 ++++++++++++++++++++++++++++++++------
src/pragma.c | 4 +++-
src/prepare.c | 4 ++--
src/sqlite.h.in | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
src/test1.c | 28 +++++++++++++++++++++++++
src/vacuum.c | 4 ++--
src/vdbe.c | 4 ++--
src/vdbeaux.c | 4 ++--
test/trans.test | 40 +++++++++++++++++++++++++++++++++++-
16 files changed, 215 insertions(+), 53 deletions(-)
diff --git a/manifest b/manifest
index 4b8bd936e0..68c67e596b 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Reduce\sthe\sN\sin\sthe\slogN\sterm\sfor\sthe\ssorting\scost\sassociated\swith\scomputing\nDISTINCT\sby\sB-Tree\sby\shalf,\sunder\sthe\sassumption\sthat\sthe\sDISTINCT\swill\neliminate\sabout\shalf\sthe\srows\sof\soutput.\s\sThis\sis\sreally\sa\swild\sguess.\s\sBut\nwe\sdo\snot\shave\sany\sbetter\sway\sof\sestimating\swhat\sthe\srow-count\sreduction\sdue\nto\sDISTINCT\swill\sactually\sbe.
-D 2020-08-24T23:44:27.235
+C Add\ssupport\sfor\sthe\ssqlite3_txn_state()\sinterface.
+D 2020-08-25T19:09:07.606
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -471,14 +471,14 @@ F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c 805de23ddca536181f8f0439df989fdd4a2f76c40bc305ec9fe2f211f68c89e8
F src/analyze.c 5cffff3d355858cd22bfc6e20ac7203510d2e1cc935086eb06f4abb2f579f628
-F src/attach.c 0b11e00c166b622c84ec176773b1d691c61ad07d247809e3e1635d4e99e71d30
+F src/attach.c 0f497c15c4cfe3bdcb214f0dbdbbb6c5ed7e8a9308ac445c7959f5e5780437a9
F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06
-F src/backup.c b1c90cd4110248c8e1273ff4578d3a84c0c34725e1b96dacd4a6294a908702de
+F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
-F src/btree.c 1439fd9b45d4d1883c53752daef42af489adaa1a1508fa39dedbc9c80ea21a2f
-F src/btree.h 7af72bbb4863c331c8f6753277ab40ee67d2a2125a63256d5c25489722ec162b
-F src/btreeInt.h 83166f6daeb91062b6ae9ee6247b3ad07e40eba58f3c05ba9e8dedad4ab1ea38
+F src/btree.c 634381c86f363dfd470c9dbe64c07363e746cb9917573f67381c861b1d264d8d
+F src/btree.h c299ab8b279230de1ef457f298ade9848c7339de6ef88a55beaf62bf0345eb15
+F src/btreeInt.h d1f713b2947a054c3532154a4d6b2bb8c4698fb54432f171966bdd06728ab1be
F src/build.c a80bc79f0be20185e2005b74e9a23f8abb8fbb3cc54ed769a21865f79d507d90
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
@@ -499,7 +499,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 1103270dfc1a94d1ca69f36dc3e021a335459583195e4b9e5a4d6e3c840279ba
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
-F src/main.c 09580279145f27f3db206ef44dcb3a8875a42644230f79c7e54aff35e71668f0
+F src/main.c d71b989398a4cdb4e7ece0478b763834d7732fb78dd24702d36366743853ac82
F src/malloc.c 22d5bdd9fe88ae4fad1b91a1b9735104b82853ffef868f1f05517d60dc1875f5
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@@ -528,16 +528,16 @@ F src/parse.y 5bdb760a29c0b25caf7e80e82210b81cd2ea3066d5199ca29e6eac40b34bc184
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
-F src/pragma.c bdb600be936f66b9fe69d26dfbba4528beaaf4f95c479c85b328a92484e0bf71
+F src/pragma.c 5435b9fe17f7728bd460f52d6d9388e7e45658c6f5549f28fc2d408be9efd2d5
F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
-F src/prepare.c 3d5a761d026052bc888d1b803a06dd2bfe245e8e836d4689f927003549148b0f
+F src/prepare.c 38ae9c2e3550bfa496886a862a5344c420ded052fd92294f409a07a53f372ffe
F src/printf.c 9efcd4e984f22bcccb1ded37a1178cac98f6e3a0534e1e0629f64899971f8838
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
F src/shell.c.in b6d5d6ebeb8903e4946f23f0886f24133e0a9b6ecbc4cf90ede422ba297e73d5
-F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd091f
+F src/sqlite.h.in b91e4a5b9b25eb95260be0bf9716d2bdba0da06b72eb439f41592b226f58881d
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
F src/sqliteInt.h 7dd1f3a93e801c90cf108149d041c6cc32d3e9503d66aa415455dae1614b6b53
@@ -545,7 +545,7 @@ F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a3
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 986b6391f02cd9b53c1d688be55899f6ffddeb8e8014cd83c1b73ff912579a71
-F src/test1.c 24b9cd0863ecc4d3920f4999c40e876c2bd92f3cc5879c48b99abe02c546ed18
+F src/test1.c 9e52fb797bf74fa327295df38881aa3ade0824bfb0c14abd0719e555b169fd55
F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5
F src/test3.c 61798bb0d38b915067a8c8e03f5a534b431181f802659a6616f9b4ff7d872644
F src/test4.c 7c4420e01c577b5c4add2cb03119743b1a357543d347773b9e717195ea967159
@@ -606,12 +606,12 @@ F src/update.c 55a6203008d033fc1a9c125d7a0a61efdb79bbb2e6db427b917d1d427b4639be
F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c8bf30c4356b091bcc3b624d0e24b2b4d11b8be4d6c90d8e0705971e15cc819b
-F src/vacuum.c 1c4f8e2f39d950037f4cf946b6858c993d3a54c3101f78e05c76460a073afcf0
-F src/vdbe.c e9f7f818f128c8600058c0eabb6b3975974c95153a104d340f419adabbc15b9f
+F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
+F src/vdbe.c e88c94a53f571b6cdc67a8dbdc2ac49ddb3c5b2435aad72d68612b2464728faa
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 762abffb7709f19c2cb74af1bba73a900f762e64f80d69c31c9ae89ed1066b60
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
-F src/vdbeaux.c 73854da7a9a4f12db72a855758214173c82f46a14be6cb19e63677ba02c97cae
+F src/vdbeaux.c b39d2e0e7126cd4629874dd7b67162b9f0d200b620d2b4c16d400949a2f1094b
F src/vdbeblob.c 253ed82894924c362a7fa3079551d3554cd1cdace39aa833da77d3bc67e7c1b1
F src/vdbemem.c 947f2a65910edb4014dc981d33e414a68c51f169f9df8c4c493a0ba840b6eb1f
F src/vdbesort.c 2be76d26998ce2b3324cdcc9f6443728e54b6c7677c553ad909c7d7cfab587df
@@ -1588,7 +1588,7 @@ F test/tpch01.test 7c4eb8cdd79c568f46d344b3e789c9fdb8a766d112871352704861f3fca32
F test/trace.test a659a9862957f4789e37a92b3bf6d2caf5c86b02cdeefc41e850ae53acf6992a
F test/trace2.test f5cb67ad3bc09e0c58e8cca78dfd0b5639259983
F test/trace3.test 1dff966888773ff1bfea01c080caf15417892b3f998408fe920c4791f7337144
-F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
+F test/trans.test 45f6f9ab6f66a7b5744f1caac06b558f95da62501916906cf55586a896f9f439
F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94
F test/transitive1.test 293300f46916569f08875cdb2fe2134be2c27677
@@ -1879,7 +1879,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 493a25949b9a6d0be82169b597133e491d8be4f4147b6eae135b06c1d810abd3
-R ddd62187ac7223d5e6ce61819bf672f8
+P 8787417ec1da8071d84c6ff0d7a90b5fd458ab6baba871327f36bc4e1bceca61
+R 722b615829cb4461022a7ec168b6d94f
U drh
-Z 3f2dc6629d15095497f0f8f6b9a935ba
+Z af427d9ac0f51142694fe72fc2db903f
diff --git a/manifest.uuid b/manifest.uuid
index 7544a576c2..59ffa50ff6 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-8787417ec1da8071d84c6ff0d7a90b5fd458ab6baba871327f36bc4e1bceca61
\ No newline at end of file
+ad195e3dd89d0f33b50070c18fb8f43c4eb24162515dfdd7c04d9e7d96b902a2
\ No newline at end of file
diff --git a/src/attach.c b/src/attach.c
index 545159d3ea..3b5c57f0cc 100644
--- a/src/attach.c
+++ b/src/attach.c
@@ -293,7 +293,9 @@ static void detachFunc(
sqlite3_snprintf(sizeof(zErr),zErr, "cannot detach database %s", zName);
goto detach_error;
}
- if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){
+ if( sqlite3BtreeTxnState(pDb->pBt)!=SQLITE_TXN_NONE
+ || sqlite3BtreeIsInBackup(pDb->pBt)
+ ){
sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName);
goto detach_error;
}
diff --git a/src/backup.c b/src/backup.c
index 77e7ed950f..2b286de6bd 100644
--- a/src/backup.c
+++ b/src/backup.c
@@ -123,7 +123,7 @@ static int setDestPgsz(sqlite3_backup *p){
** message in database handle db.
*/
static int checkReadTransaction(sqlite3 *db, Btree *p){
- if( sqlite3BtreeIsInReadTrans(p) ){
+ if( sqlite3BtreeTxnState(p)!=SQLITE_TXN_NONE ){
sqlite3ErrorWithMsg(db, SQLITE_ERROR, "destination database is in use");
return SQLITE_ERROR;
}
@@ -354,7 +354,7 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
** one now. If a transaction is opened here, then it will be closed
** before this function exits.
*/
- if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){
+ if( rc==SQLITE_OK && SQLITE_TXN_NONE==sqlite3BtreeTxnState(p->pSrc) ){
rc = sqlite3BtreeBeginTrans(p->pSrc, 0, 0);
bCloseTrans = 1;
}
@@ -726,7 +726,7 @@ int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
sqlite3BtreeEnter(pTo);
sqlite3BtreeEnter(pFrom);
- assert( sqlite3BtreeIsInTrans(pTo) );
+ assert( sqlite3BtreeTxnState(pTo)==SQLITE_TXN_WRITE );
pFd = sqlite3PagerFile(sqlite3BtreePager(pTo));
if( pFd->pMethods ){
i64 nByte = sqlite3BtreeGetPageSize(pFrom)*(i64)sqlite3BtreeLastPage(pFrom);
@@ -762,7 +762,7 @@ int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
sqlite3PagerClearCache(sqlite3BtreePager(b.pDest));
}
- assert( sqlite3BtreeIsInTrans(pTo)==0 );
+ assert( sqlite3BtreeTxnState(pTo)!=SQLITE_TXN_WRITE );
copy_finished:
sqlite3BtreeLeave(pFrom);
sqlite3BtreeLeave(pTo);
diff --git a/src/btree.c b/src/btree.c
index 919d3b87cd..4579121697 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -10310,11 +10310,12 @@ const char *sqlite3BtreeGetJournalname(Btree *p){
}
/*
-** Return non-zero if a transaction is active.
+** Return one of SQLITE_TXN_NONE, SQLITE_TXN_READ, or SQLITE_TXN_WRITE
+** to describe the current transaction state of Btree p.
*/
-int sqlite3BtreeIsInTrans(Btree *p){
+int sqlite3BtreeTxnState(Btree *p){
assert( p==0 || sqlite3_mutex_held(p->db->mutex) );
- return (p && (p->inTrans==TRANS_WRITE));
+ return p ? p->inTrans : 0;
}
#ifndef SQLITE_OMIT_WAL
@@ -10343,14 +10344,8 @@ int sqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLog, int *pnCkpt){
#endif
/*
-** Return non-zero if a read (or write) transaction is active.
+** Return true if there is currently a backup running on Btree p.
*/
-int sqlite3BtreeIsInReadTrans(Btree *p){
- assert( p );
- assert( sqlite3_mutex_held(p->db->mutex) );
- return p->inTrans!=TRANS_NONE;
-}
-
int sqlite3BtreeIsInBackup(Btree *p){
assert( p );
assert( sqlite3_mutex_held(p->db->mutex) );
diff --git a/src/btree.h b/src/btree.h
index 5dd5287d18..4763ee04c4 100644
--- a/src/btree.h
+++ b/src/btree.h
@@ -85,8 +85,7 @@ int sqlite3BtreeCommit(Btree*);
int sqlite3BtreeRollback(Btree*,int,int);
int sqlite3BtreeBeginStmt(Btree*,int);
int sqlite3BtreeCreateTable(Btree*, Pgno*, int flags);
-int sqlite3BtreeIsInTrans(Btree*);
-int sqlite3BtreeIsInReadTrans(Btree*);
+int sqlite3BtreeTxnState(Btree*);
int sqlite3BtreeIsInBackup(Btree*);
void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
int sqlite3BtreeSchemaLocked(Btree *pBtree);
diff --git a/src/btreeInt.h b/src/btreeInt.h
index c6dfa27ef5..bffe09b617 100644
--- a/src/btreeInt.h
+++ b/src/btreeInt.h
@@ -364,11 +364,25 @@ struct Btree {
** If the shared-data extension is enabled, there may be multiple users
** of the Btree structure. At most one of these may open a write transaction,
** but any number may have active read transactions.
+**
+** These values must match SQLITE_TXN_NONE, SQLITE_TXN_READ, and
+** SQLITE_TXN_WRITE
*/
#define TRANS_NONE 0
#define TRANS_READ 1
#define TRANS_WRITE 2
+#if TRANS_NONE!=SQLITE_TXN_NONE
+# error wrong numeric code for no-transaction
+#endif
+#if TRANS_READ!=SQLITE_TXN_READ
+# error wrong numeric code for read-transaction
+#endif
+#if TRANS_WRITE!=SQLITE_TXN_WRITE
+# error wrong numeric code for write-transaction
+#endif
+
+
/*
** An instance of this object represents a single database file.
**
diff --git a/src/main.c b/src/main.c
index 831e06e933..917028c7bf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -897,7 +897,7 @@ int sqlite3_db_cacheflush(sqlite3 *db){
sqlite3BtreeEnterAll(db);
for(i=0; rc==SQLITE_OK && inDb; i++){
Btree *pBt = db->aDb[i].pBt;
- if( pBt && sqlite3BtreeIsInTrans(pBt) ){
+ if( pBt && sqlite3BtreeTxnState(pBt)==SQLITE_TXN_WRITE ){
Pager *pPager = sqlite3BtreePager(pBt);
rc = sqlite3PagerFlush(pPager);
if( rc==SQLITE_BUSY ){
@@ -1241,6 +1241,36 @@ static int sqlite3Close(sqlite3 *db, int forceZombie){
return SQLITE_OK;
}
+/*
+** Return the transaction state for a single databse, or the maximum
+** transaction state over all attached databases if zSchema is null.
+*/
+int sqlite3_txn_state(sqlite3 *db, const char *zSchema){
+ int iDb, nDb;
+ int iTxn = -1;
+#ifdef SQLITE_ENABLE_API_ARMOR
+ if( !sqlite3SafetyCheckOk(db) ){
+ (void)SQLITE_MISUSE_BKPT;
+ return -1;
+ }
+#endif
+ sqlite3_mutex_enter(db->mutex);
+ if( zSchema ){
+ nDb = iDb = sqlite3FindDbName(db, zSchema);
+ if( iDb<0 ) nDb--;
+ }else{
+ iDb = 0;
+ nDb = db->nDb-1;
+ }
+ for(; iDb<=nDb; iDb++){
+ Btree *pBt = db->aDb[iDb].pBt;
+ int x = pBt!=0 ? sqlite3BtreeTxnState(pBt) : SQLITE_TXN_NONE;
+ if( x>iTxn ) iTxn = x;
+ }
+ sqlite3_mutex_leave(db->mutex);
+ return iTxn;
+}
+
/*
** Two variations on the public interface for closing a database
** connection. The sqlite3_close() version returns SQLITE_BUSY and
@@ -1401,7 +1431,7 @@ void sqlite3RollbackAll(sqlite3 *db, int tripCode){
for(i=0; inDb; i++){
Btree *p = db->aDb[i].pBt;
if( p ){
- if( sqlite3BtreeIsInTrans(p) ){
+ if( sqlite3BtreeTxnState(p)==SQLITE_TXN_WRITE ){
inTrans = 1;
}
sqlite3BtreeRollback(p, tripCode, !schemaChange);
@@ -4440,7 +4470,7 @@ int sqlite3_snapshot_get(
int iDb = sqlite3FindDbName(db, zDb);
if( iDb==0 || iDb>1 ){
Btree *pBt = db->aDb[iDb].pBt;
- if( 0==sqlite3BtreeIsInTrans(pBt) ){
+ if( SQLITE_TXN_WRITE!=sqlite3BtreeTxnState(pBt) ){
rc = sqlite3BtreeBeginTrans(pBt, 0, 0);
if( rc==SQLITE_OK ){
rc = sqlite3PagerSnapshotGet(sqlite3BtreePager(pBt), ppSnapshot);
@@ -4476,10 +4506,10 @@ int sqlite3_snapshot_open(
iDb = sqlite3FindDbName(db, zDb);
if( iDb==0 || iDb>1 ){
Btree *pBt = db->aDb[iDb].pBt;
- if( sqlite3BtreeIsInTrans(pBt)==0 ){
+ if( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE ){
Pager *pPager = sqlite3BtreePager(pBt);
int bUnlock = 0;
- if( sqlite3BtreeIsInReadTrans(pBt) ){
+ if( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_NONE ){
if( db->nVdbeActive==0 ){
rc = sqlite3PagerSnapshotCheck(pPager, pSnapshot);
if( rc==SQLITE_OK ){
@@ -4528,7 +4558,7 @@ int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb){
iDb = sqlite3FindDbName(db, zDb);
if( iDb==0 || iDb>1 ){
Btree *pBt = db->aDb[iDb].pBt;
- if( 0==sqlite3BtreeIsInReadTrans(pBt) ){
+ if( SQLITE_TXN_NONE==sqlite3BtreeTxnState(pBt) ){
rc = sqlite3BtreeBeginTrans(pBt, 0, 0);
if( rc==SQLITE_OK ){
rc = sqlite3PagerSnapshotRecover(sqlite3BtreePager(pBt));
diff --git a/src/pragma.c b/src/pragma.c
index 97ad5ac90b..df7d2c943b 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -131,7 +131,9 @@ static int getTempStore(const char *z){
static int invalidateTempStorage(Parse *pParse){
sqlite3 *db = pParse->db;
if( db->aDb[1].pBt!=0 ){
- if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){
+ if( !db->autoCommit
+ || sqlite3BtreeTxnState(db->aDb[1].pBt)!=SQLITE_TXN_NONE
+ ){
sqlite3ErrorMsg(pParse, "temporary storage cannot be changed "
"from within a transaction");
return SQLITE_ERROR;
diff --git a/src/prepare.c b/src/prepare.c
index 8e2186b102..dac12d8a5b 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -240,7 +240,7 @@ int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){
** on the b-tree database, open one now. If a transaction is opened, it
** will be closed before this function returns. */
sqlite3BtreeEnter(pDb->pBt);
- if( !sqlite3BtreeIsInReadTrans(pDb->pBt) ){
+ if( sqlite3BtreeTxnState(pDb->pBt)==SQLITE_TXN_NONE ){
rc = sqlite3BtreeBeginTrans(pDb->pBt, 0, 0);
if( rc!=SQLITE_OK ){
sqlite3SetString(pzErrMsg, db, sqlite3ErrStr(rc));
@@ -483,7 +483,7 @@ static void schemaIsValid(Parse *pParse){
/* If there is not already a read-only (or read-write) transaction opened
** on the b-tree database, open one now. If a transaction is opened, it
** will be closed immediately after reading the meta-value. */
- if( !sqlite3BtreeIsInReadTrans(pBt) ){
+ if( sqlite3BtreeTxnState(pBt)==SQLITE_TXN_NONE ){
rc = sqlite3BtreeBeginTrans(pBt, 0, 0);
if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
sqlite3OomFault(db);
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index dbcc0e9893..9a372d32bb 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -6186,6 +6186,57 @@ const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
*/
int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
+/*
+** CAPI3REF: Determine the transaction state of a database
+** METHOD: sqlite3
+**
+** ^The sqlite3_txn_state(D,S) interface returns the current
+** [transaction state] of schema S in database connection D. ^If S is NULL,
+** then the highest transaction state of any schema on databse connection D
+** is returned. Transaction states are (in order of lowest to highest):
+**
+** - SQLITE_TXN_NONE
+**
- SQLITE_TXN_READ
+**
- SQLITE_TXN_WRITE
+**
+** ^If the S argument to sqlite3_txn_state(D,S) is in the name of
+** a valid schema, then -1 is returned.
+*/
+int sqlite3_txn_state(sqlite3*,const char *zSchema);
+
+/*
+** CAPI3REF: Allowed return values from [sqlite3_txn_state()]
+** KEYWORDS: {transaction state}
+**
+** These constants define the current transaction state of a database file.
+** ^The [sqlite3_txn_state(D,S)] interface returns one of these
+** constants in order to describe the transaction state of schema S
+** in [database connection] D.
+**
+**
+** [[SQLITE_TXN_NONE]] - SQLITE_TXN_NONE
+** - The SQLITE_TXN_NONE state means that no transaction is currently
+** pending.
+**
+** [[SQLITE_TXN_READ]] - SQLITE_TXN_READ
+** - The SQLITE_TXN_READ state means that the database is currently
+** in a read transaction. Content has been read from the database file
+** but nothing in the database file has changed. The transaction state
+** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
+** no other conflicting concurrent write transactions. The transaction
+** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
+** [COMMIT].
+**
+** [[SQLITE_TXN_WRITE]] - SQLITE_TXN_WRITE
+** - The SQLITE_TXN_WRITE state means that the database is currently
+** in a write transaction. Content has been written to the database file
+** but has not yet committed. The transaction state will change to
+** to SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].
+*/
+#define SQLITE_TXN_NONE 0
+#define SQLITE_TXN_READ 1
+#define SQLITE_TXN_WRITE 2
+
/*
** CAPI3REF: Find the next prepared statement
** METHOD: sqlite3
@@ -9345,6 +9396,7 @@ void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
/*
** CAPI3REF: Flush caches to disk mid-transaction
+** METHOD: sqlite3
**
** ^If a write-transaction is open on [database connection] D when the
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
@@ -9377,6 +9429,7 @@ int sqlite3_db_cacheflush(sqlite3*);
/*
** CAPI3REF: The pre-update hook.
+** METHOD: sqlite3
**
** ^These interfaces are only available if SQLite is compiled using the
** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option.
@@ -9479,6 +9532,7 @@ int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
/*
** CAPI3REF: Low-level system error code
+** METHOD: sqlite3
**
** ^Attempt to return the underlying operating system error code or error
** number that caused the most recent I/O error or failure to open a file.
diff --git a/src/test1.c b/src/test1.c
index 9904402108..04b9f7a011 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -7749,6 +7749,33 @@ static int SQLITE_TCLAPI test_sqlite3_db_config(
Tcl_SetObjResult(interp, Tcl_NewIntObj(v));
return TCL_OK;
}
+/*
+** tclcmd: sqlite3_txn_state DB ?SCHEMA?
+**
+** Invoke sqlite3_txn_state(DB,SCHEMA) and return the
+** numeric value that results. Use NULL for SCHEMA if the 3 argument
+** is omitted.
+*/
+static int SQLITE_TCLAPI test_sqlite3_txn_state(
+ void *clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ sqlite3 *db;
+ const char *zSchema;
+ int iTxn;
+
+ if( objc!=2 && objc!=3 ){
+ Tcl_WrongNumArgs(interp, 1, objv, "DB ?SCHEMA?");
+ return TCL_ERROR;
+ }
+ if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
+ zSchema = objc==3 ? Tcl_GetString(objv[2]) : 0;
+ iTxn = sqlite3_txn_state(db, zSchema);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(iTxn));
+ return TCL_OK;
+}
/*
** Change the name of the main database schema from "main" to "icecube".
@@ -7985,6 +8012,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
void *clientData;
} aObjCmd[] = {
{ "sqlite3_db_config", test_sqlite3_db_config, 0 },
+ { "sqlite3_txn_state", test_sqlite3_txn_state, 0 },
{ "bad_behavior", test_bad_behavior, (void*)&iZero },
{ "register_dbstat_vtab", test_register_dbstat_vtab },
{ "sqlite3_connection_pointer", get_sqlite_pointer, 0 },
diff --git a/src/vacuum.c b/src/vacuum.c
index 50875d8d3d..93e2307d1a 100644
--- a/src/vacuum.c
+++ b/src/vacuum.c
@@ -339,8 +339,8 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
BTREE_APPLICATION_ID, 0, /* Preserve the application id */
};
- assert( 1==sqlite3BtreeIsInTrans(pTemp) );
- assert( pOut!=0 || 1==sqlite3BtreeIsInTrans(pMain) );
+ assert( SQLITE_TXN_WRITE==sqlite3BtreeTxnState(pTemp) );
+ assert( pOut!=0 || SQLITE_TXN_WRITE==sqlite3BtreeTxnState(pMain) );
/* Copy Btree meta values */
for(i=0; ip2
&& (db->autoCommit==0 || db->nVdbeRead>1)
){
- assert( sqlite3BtreeIsInTrans(pBt) );
+ assert( sqlite3BtreeTxnState(pBt)==SQLITE_TXN_WRITE );
if( p->iStatement==0 ){
assert( db->nStatement>=0 && db->nSavepoint>=0 );
db->nStatement++;
@@ -7038,7 +7038,7 @@ case OP_JournalMode: { /* out2 */
/* Open a transaction on the database file. Regardless of the journal
** mode, this transaction always uses a rollback journal.
*/
- assert( sqlite3BtreeIsInTrans(pBt)==0 );
+ assert( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE );
if( rc==SQLITE_OK ){
rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));
}
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 5f8b8a817b..5dff54fc85 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -2663,7 +2663,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
*/
for(i=0; rc==SQLITE_OK && inDb; i++){
Btree *pBt = db->aDb[i].pBt;
- if( sqlite3BtreeIsInTrans(pBt) ){
+ if( sqlite3BtreeTxnState(pBt)==SQLITE_TXN_WRITE ){
/* Whether or not a database might need a super-journal depends upon
** its journal mode (among other things). This matrix determines which
** journal modes use a super-journal and which do not */
@@ -2798,7 +2798,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
*/
for(i=0; inDb; i++){
Btree *pBt = db->aDb[i].pBt;
- if( sqlite3BtreeIsInTrans(pBt) ){
+ if( sqlite3BtreeTxnState(pBt)==SQLITE_TXN_WRITE ){
char const *zFile = sqlite3BtreeGetJournalname(pBt);
if( zFile==0 ){
continue; /* Ignore TEMP and :memory: databases */
diff --git a/test/trans.test b/test/trans.test
index bbaedc5450..6b8ad217a0 100644
--- a/test/trans.test
+++ b/test/trans.test
@@ -11,7 +11,6 @@
# This file implements regression tests for SQLite library. The
# focus of this script is database locks.
#
-# $Id: trans.test,v 1.41 2009/04/28 16:37:59 danielk1977 Exp $
set testdir [file dirname $argv0]
@@ -39,6 +38,19 @@ do_test trans-1.1 {
SELECT b FROM two ORDER BY a;
}
} {I V X}
+do_test trans-1.2.1 {
+ sqlite3_txn_state db
+} {0}
+do_test trans-1.2.2 {
+ sqlite3_txn_state db main
+} {0}
+do_test trans-1.2.3 {
+ sqlite3_txn_state db temp
+} {0}
+do_test trans-1.2.4 {
+ sqlite3_txn_state db no-such-schema
+} {-1}
+
do_test trans-1.9 {
sqlite3 altdb test.db
execsql {SELECT b FROM one ORDER BY a} altdb
@@ -55,6 +67,9 @@ do_test trans-2.1 {
set v [catch {execsql {BEGIN}} msg]
lappend v $msg
} {0 {}}
+do_test trans-2.1b {
+ sqlite3_txn_state db
+} {0}
do_test trans-2.2 {
set v [catch {execsql {END}} msg]
lappend v $msg
@@ -95,6 +110,16 @@ do_test trans-3.1 {
SELECT a FROM one ORDER BY a;
}
} {1 2 3}
+do_test trans-3.1b {
+ sqlite3_txn_state db
+} {2}
+do_test trans-3.1c {
+ sqlite3_txn_state db main
+} {2}
+do_test trans-3.1d {
+ sqlite3_txn_state db temp
+} {0}
+
do_test trans-3.2 {
catchsql {
SELECT a FROM two ORDER BY a;
@@ -139,6 +164,10 @@ do_test trans-3.9 {
do_test trans-3.10 {
execsql {END TRANSACTION}
} {}
+do_test trans-3.10b {
+ sqlite3_txn_state db
+} {0}
+
do_test trans-3.11 {
set v [catch {execsql {
@@ -252,6 +281,15 @@ do_test trans-5.2 {
execsql {BEGIN TRANSACTION}
execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name}
} {}
+do_test trans-5.2b {
+ sqlite3_txn_state db
+} {1}
+do_test trans-5.2c {
+ sqlite3_txn_state db main
+} {1}
+do_test trans-5.2d {
+ sqlite3_txn_state db temp
+} {0}
do_test trans-5.3 {
execsql {CREATE TABLE one(a text, b int)}
execsql {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name}
From 30497f416939666b3fce0e879c4cc192f240c67e Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 26 Aug 2020 10:50:48 +0000
Subject: [PATCH 030/169] If the argument to the ".read" command in the CLI
begins with "|" then run the remainder of the argument as a command and read
input from the output of that command.
FossilOrigin-Name: 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/shell.c.in | 13 ++++++++++---
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/manifest b/manifest
index 68c67e596b..d029b62809 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\ssupport\sfor\sthe\ssqlite3_txn_state()\sinterface.
-D 2020-08-25T19:09:07.606
+C If\sthe\sargument\sto\sthe\s".read"\scommand\sin\sthe\sCLI\sbegins\swith\s"|"\sthen\nrun\sthe\sremainder\sof\sthe\sargument\sas\sa\scommand\sand\sread\sinput\sfrom\sthe\noutput\sof\sthat\scommand.
+D 2020-08-26T10:50:48.952
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -536,7 +536,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
-F src/shell.c.in b6d5d6ebeb8903e4946f23f0886f24133e0a9b6ecbc4cf90ede422ba297e73d5
+F src/shell.c.in 13b9ba4db8aa968de52921b86a0404683369577916a8e784d063725a1e1be502
F src/sqlite.h.in b91e4a5b9b25eb95260be0bf9716d2bdba0da06b72eb439f41592b226f58881d
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1879,7 +1879,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 8787417ec1da8071d84c6ff0d7a90b5fd458ab6baba871327f36bc4e1bceca61
-R 722b615829cb4461022a7ec168b6d94f
+P ad195e3dd89d0f33b50070c18fb8f43c4eb24162515dfdd7c04d9e7d96b902a2
+R 2ccdd1b757645c61965446903a6a0fca
U drh
-Z af427d9ac0f51142694fe72fc2db903f
+Z 4c5d539d1c5c3691ef762ff2f3c4571e
diff --git a/manifest.uuid b/manifest.uuid
index 59ffa50ff6..6543348b67 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-ad195e3dd89d0f33b50070c18fb8f43c4eb24162515dfdd7c04d9e7d96b902a2
\ No newline at end of file
+6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492
\ No newline at end of file
diff --git a/src/shell.c.in b/src/shell.c.in
index 8d238d4ab6..61654f994e 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -8962,9 +8962,16 @@ static int do_meta_command(char *zLine, ShellState *p){
rc = 1;
goto meta_command_exit;
}
- if( notNormalFile(azArg[1])
- || (p->in = fopen(azArg[1], "rb"))==0
- ){
+ if( azArg[1][0]=='|' ){
+ p->in = popen(azArg[1]+1, "r");
+ if( p->in==0 ){
+ utf8_printf(stderr, "Error: cannot open \"%s\"\n", azArg[1]);
+ rc = 1;
+ }else{
+ rc = process_input(p);
+ pclose(p->in);
+ }
+ }else if( notNormalFile(azArg[1]) || (p->in = fopen(azArg[1], "rb"))==0 ){
utf8_printf(stderr,"Error: cannot open \"%s\"\n", azArg[1]);
rc = 1;
}else{
From 60081a03825a991ad08864f8d57f408a5c4002bb Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 26 Aug 2020 19:07:18 +0000
Subject: [PATCH 031/169] Enhance the ".databases" command in the CLI so that
it shows the result of sqlite3_db_readonly() and sqlite3_txn_state() for each
database file.
FossilOrigin-Name: 0ffd16d23dd3b6467cce31af506c70fde44c3796d386c2a03896e43a6d683e60
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/shell.c.in | 45 +++++++++++++++++++++++++++++++++------------
3 files changed, 40 insertions(+), 19 deletions(-)
diff --git a/manifest b/manifest
index d029b62809..d50974cfe3 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C If\sthe\sargument\sto\sthe\s".read"\scommand\sin\sthe\sCLI\sbegins\swith\s"|"\sthen\nrun\sthe\sremainder\sof\sthe\sargument\sas\sa\scommand\sand\sread\sinput\sfrom\sthe\noutput\sof\sthat\scommand.
-D 2020-08-26T10:50:48.952
+C Enhance\sthe\s".databases"\scommand\sin\sthe\sCLI\sso\sthat\sit\sshows\sthe\sresult\nof\ssqlite3_db_readonly()\sand\ssqlite3_txn_state()\sfor\seach\sdatabase\sfile.
+D 2020-08-26T19:07:18.179
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -536,7 +536,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
-F src/shell.c.in 13b9ba4db8aa968de52921b86a0404683369577916a8e784d063725a1e1be502
+F src/shell.c.in d9aae37f76cc45b4ef6e8949979dbd124f9e5031789116c85d1aca396a37a403
F src/sqlite.h.in b91e4a5b9b25eb95260be0bf9716d2bdba0da06b72eb439f41592b226f58881d
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1879,7 +1879,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 ad195e3dd89d0f33b50070c18fb8f43c4eb24162515dfdd7c04d9e7d96b902a2
-R 2ccdd1b757645c61965446903a6a0fca
+P 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492
+R 5c84472adafd40f98e2c21d6cafe8196
U drh
-Z 4c5d539d1c5c3691ef762ff2f3c4571e
+Z 0b7b01fe50d1610940d1117a5b7f17be
diff --git a/manifest.uuid b/manifest.uuid
index 6543348b67..17c2a0c1b3 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492
\ No newline at end of file
+0ffd16d23dd3b6467cce31af506c70fde44c3796d386c2a03896e43a6d683e60
\ No newline at end of file
diff --git a/src/shell.c.in b/src/shell.c.in
index 61654f994e..d70ee318b9 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -7583,21 +7583,42 @@ static int do_meta_command(char *zLine, ShellState *p){
}else
if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
- ShellState data;
- char *zErrMsg = 0;
+ char **azName = 0;
+ int nName = 0;
+ sqlite3_stmt *pStmt;
+ int rc;
+ int i;
open_db(p, 0);
- memcpy(&data, p, sizeof(data));
- data.showHeader = 0;
- data.cMode = data.mode = MODE_List;
- sqlite3_snprintf(sizeof(data.colSeparator),data.colSeparator,": ");
- data.cnt = 0;
- sqlite3_exec(p->db, "SELECT name, file FROM pragma_database_list",
- callback, &data, &zErrMsg);
- if( zErrMsg ){
- utf8_printf(stderr,"Error: %s\n", zErrMsg);
- sqlite3_free(zErrMsg);
+ rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
+ if( rc ){
+ utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
rc = 1;
+ }else{
+ while( sqlite3_step(pStmt)==SQLITE_ROW ){
+ const char *zSchema = (const char *)sqlite3_column_text(pStmt,1);
+ const char *zFile = (const char*)sqlite3_column_text(pStmt,2);
+ azName = sqlite3_realloc(azName, (nName+1)*2*sizeof(char*));
+ if( azName==0 ){ shell_out_of_memory(); /* Does not return */ }
+ azName[nName*2] = strdup(zSchema);
+ azName[nName*2+1] = strdup(zFile);
+ nName++;
+ }
}
+ sqlite3_finalize(pStmt);
+ for(i=0; idb, azName[i*2]);
+ int bRdonly = sqlite3_db_readonly(p->db, azName[i*2]);
+ const char *z = azName[i*2+1];
+ utf8_printf(p->out, "%s: %s %s%s\n",
+ azName[i*2],
+ z && z[0] ? z : "\"\"",
+ bRdonly ? "r/o" : "r/w",
+ eTxn==SQLITE_TXN_NONE ? "" :
+ eTxn==SQLITE_TXN_READ ? " read-txn" : " write-txn");
+ free(azName[i*2]);
+ free(azName[i*2+1]);
+ }
+ sqlite3_free(azName);
}else
if( c=='d' && n>=3 && strncmp(azArg[0], "dbconfig", n)==0 ){
From ca3ee7e18a9ba842316e8bf38ee3548639ed92a4 Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 27 Aug 2020 14:53:47 +0000
Subject: [PATCH 032/169] Do not attempt to run test script analyze3.test as
part of the "prepare" permutation.
FossilOrigin-Name: f7f13cb1bc699c034a3f5f7a2431c8055cb79e2a14d5e70e1fc5dd6dec00fb26
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
test/analyze3.test | 10 ++++++++++
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index d50974cfe3..91890d23a0 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enhance\sthe\s".databases"\scommand\sin\sthe\sCLI\sso\sthat\sit\sshows\sthe\sresult\nof\ssqlite3_db_readonly()\sand\ssqlite3_txn_state()\sfor\seach\sdatabase\sfile.
-D 2020-08-26T19:07:18.179
+C Do\snot\sattempt\sto\srun\stest\sscript\sanalyze3.test\sas\spart\sof\sthe\s"prepare"\spermutation.
+D 2020-08-27T14:53:47.372
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -649,7 +649,7 @@ F test/altertab2.test b0d62f323ca5dab42b0bc028c52e310ebdd13e655e8fac070fe622bad7
F test/altertab3.test d0d51e652aaa11e37de1f1215181d88334fefcb185f3b9bd91e06e98260c4694
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
F test/analyze.test 547bb700f903107b38611b014ca645d6b5bb819f5210d7bf39c40802aafeb7d7
-F test/analyze3.test 01f0b122e3e54ad2544f14f7cc7dcb4c2cb8753cad5e88c6b8d49615b3fd6a2b
+F test/analyze3.test fca2a9de0017becfdcc201647f03b1cfd5ba0e7b5b5c852936e4ec62780cde49
F test/analyze4.test cdf88f3f72b0f0643a1ff6c730fc5af1e42464d47478d9fbac84c333f72c014e
F test/analyze5.test fa5131952303ac4146aba101b116b9c8cb89e2637531c334a6df7f7d19dddc0d
F test/analyze6.test 6c3f7df2996cb6872f355a6ac1eb6d5de00a5a9288214bad7ef25c97d9cc72dc
@@ -1879,7 +1879,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 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492
-R 5c84472adafd40f98e2c21d6cafe8196
-U drh
-Z 0b7b01fe50d1610940d1117a5b7f17be
+P 0ffd16d23dd3b6467cce31af506c70fde44c3796d386c2a03896e43a6d683e60
+R 0a9ec4e950ccbca50a9821725e4f3e70
+U dan
+Z 0c438145530981ed0b38843be794ab6e
diff --git a/manifest.uuid b/manifest.uuid
index 17c2a0c1b3..028bff5cef 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-0ffd16d23dd3b6467cce31af506c70fde44c3796d386c2a03896e43a6d683e60
\ No newline at end of file
+f7f13cb1bc699c034a3f5f7a2431c8055cb79e2a14d5e70e1fc5dd6dec00fb26
\ No newline at end of file
diff --git a/test/analyze3.test b/test/analyze3.test
index 8cc344e22b..1f4a2722b0 100644
--- a/test/analyze3.test
+++ b/test/analyze3.test
@@ -23,6 +23,16 @@ ifcapable !stat4 {
return
}
+# This test cannot be run with the sqlite3_prepare() permutation, as it
+# tests that stat4 data can be used to influence the plans of queries
+# based on bound variable values. And this is not possible when using
+# sqlite3_prepare() - as queries cannot be internally re-prepared after
+# binding values are available.
+if {[permutation]=="prepare"} {
+ finish_test
+ return
+}
+
#----------------------------------------------------------------------
# Test Organization:
#
From 359941bd33705c1f5b1d7ed75528c764711a510a Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 27 Aug 2020 16:28:30 +0000
Subject: [PATCH 033/169] Apple the same fix for ticket [9eda2697f5cc1aba] to
text-to-integer conversions that was done for floating point conversions by
check-in [1c76f1d8ec0937a2].
FossilOrigin-Name: aafb7a21041090e529491b0ce30c3902420be0551b1b2c55840a5fbb9105fb7d
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
src/util.c | 1 +
test/atof1.test | 8 ++++----
4 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/manifest b/manifest
index 91890d23a0..3e351a9423 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Do\snot\sattempt\sto\srun\stest\sscript\sanalyze3.test\sas\spart\sof\sthe\s"prepare"\spermutation.
-D 2020-08-27T14:53:47.372
+C Apple\sthe\ssame\sfix\sfor\sticket\s[9eda2697f5cc1aba]\sto\stext-to-integer\nconversions\sthat\swas\sdone\sfor\sfloating\spoint\sconversions\sby\ncheck-in\s[1c76f1d8ec0937a2].
+D 2020-08-27T16:28:30.075
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -605,7 +605,7 @@ F src/trigger.c ef67bde309a831515dc3c2173d792574309f2f42d45f8c078743fae9f7f98c75
F src/update.c 55a6203008d033fc1a9c125d7a0a61efdb79bbb2e6db427b917d1d427b4639be
F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
-F src/util.c c8bf30c4356b091bcc3b624d0e24b2b4d11b8be4d6c90d8e0705971e15cc819b
+F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
F src/vdbe.c e88c94a53f571b6cdc67a8dbdc2ac49ddb3c5b2435aad72d68612b2464728faa
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
@@ -667,7 +667,7 @@ F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b
F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7
F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a
F test/async5.test 383ab533fdb9f7ad228cc99ee66e1acb34cc0dc0
-F test/atof1.test 1ccfc96a6888566597b83d882c81b3c04258dc39317e8c1cec89ba481eaa2fba
+F test/atof1.test 10049623e77006691c4c2978c1dc8a3f75276377a53417811aa85bda7493f963
F test/atomic.test 065a453dde33c77ff586d91ccaa6ed419829d492dbb1a5694b8a09f3f9d7d061
F test/atomic2.test b6863b4aa552543874f80b42fb3063f1c8c2e3d8e56b6562f00a3cc347b5c1da
F test/atrc.c c388fac43dbba05c804432a7135ae688b32e8f25818e9994ffba4b64cf60c27c
@@ -1879,7 +1879,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 0ffd16d23dd3b6467cce31af506c70fde44c3796d386c2a03896e43a6d683e60
-R 0a9ec4e950ccbca50a9821725e4f3e70
-U dan
-Z 0c438145530981ed0b38843be794ab6e
+P f7f13cb1bc699c034a3f5f7a2431c8055cb79e2a14d5e70e1fc5dd6dec00fb26
+R 8121e5cf7bd833473b2f967ba76c7018
+U drh
+Z 55de9e911e5f0e6470b6e0d616339b8e
diff --git a/manifest.uuid b/manifest.uuid
index 028bff5cef..721b77cdcf 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-f7f13cb1bc699c034a3f5f7a2431c8055cb79e2a14d5e70e1fc5dd6dec00fb26
\ No newline at end of file
+aafb7a21041090e529491b0ce30c3902420be0551b1b2c55840a5fbb9105fb7d
\ No newline at end of file
diff --git a/src/util.c b/src/util.c
index 2371aad17c..fb86d7d118 100644
--- a/src/util.c
+++ b/src/util.c
@@ -681,6 +681,7 @@ int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){
incr = 1;
}else{
incr = 2;
+ length &= ~1;
assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
for(i=3-enc; i
Date: Thu, 27 Aug 2020 18:36:30 +0000
Subject: [PATCH 034/169] Include the original text of the CHECK constraint in
the error message for anonymous CHECK constraints.
FossilOrigin-Name: 5ce34a955bb36d77edc9951cb7ac2ef9c876d7d3ff5852af682f558e248f428c
---
manifest | 44 +++++++++++++++++++-------------------
manifest.uuid | 2 +-
src/build.c | 13 ++++++++++--
src/parse.y | 6 +++---
src/sqliteInt.h | 2 +-
test/check.test | 44 +++++++++++++++++++++-----------------
test/conflict.test | 2 +-
test/conflict2.test | 2 +-
test/date2.test | 4 ++--
test/e_createtable.test | 22 +++++++++----------
test/fkey2.test | 4 ++--
test/func4.test | 46 ++++++++++++++++++++--------------------
test/in.test | 2 +-
test/insert4.test | 10 ++++-----
test/istrue.test | 10 ++++-----
test/pager1.test | 2 +-
test/quote.test | 2 +-
test/without_rowid1.test | 2 +-
test/without_rowid3.test | 4 ++--
19 files changed, 119 insertions(+), 104 deletions(-)
diff --git a/manifest b/manifest
index 3e351a9423..75c9acebcb 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Apple\sthe\ssame\sfix\sfor\sticket\s[9eda2697f5cc1aba]\sto\stext-to-integer\nconversions\sthat\swas\sdone\sfor\sfloating\spoint\sconversions\sby\ncheck-in\s[1c76f1d8ec0937a2].
-D 2020-08-27T16:28:30.075
+C Include\sthe\soriginal\stext\sof\sthe\sCHECK\sconstraint\sin\sthe\serror\smessage\sfor\nanonymous\sCHECK\sconstraints.
+D 2020-08-27T18:36:30.231
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 634381c86f363dfd470c9dbe64c07363e746cb9917573f67381c861b1d264d8d
F src/btree.h c299ab8b279230de1ef457f298ade9848c7339de6ef88a55beaf62bf0345eb15
F src/btreeInt.h d1f713b2947a054c3532154a4d6b2bb8c4698fb54432f171966bdd06728ab1be
-F src/build.c a80bc79f0be20185e2005b74e9a23f8abb8fbb3cc54ed769a21865f79d507d90
+F src/build.c 92b61c2be1e35a619391f17c2d1b108901ad5e4df99becc0b064a934e6ec662a
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c e98518d2d3d4029a13c805e07313fb60c877be56db76e90dd5f3af73085d0ce6
@@ -524,7 +524,7 @@ F src/os_win.c a2149ff0a85c1c3f9cc102a46c673ce87e992396ba3411bfb53db66813b32f1d
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
F src/pager.h 4bf9b3213a4b2bebbced5eaa8b219cf25d4a82f385d093cd64b7e93e5285f66f
-F src/parse.y 5bdb760a29c0b25caf7e80e82210b81cd2ea3066d5199ca29e6eac40b34bc184
+F src/parse.y 2ca57a8383e9cf9e1140706a85a4b357d6c09cfea7ba9098746a28bc8212441a
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
@@ -540,7 +540,7 @@ F src/shell.c.in d9aae37f76cc45b4ef6e8949979dbd124f9e5031789116c85d1aca396a37a40
F src/sqlite.h.in b91e4a5b9b25eb95260be0bf9716d2bdba0da06b72eb439f41592b226f58881d
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
-F src/sqliteInt.h 7dd1f3a93e801c90cf108149d041c6cc32d3e9503d66aa415455dae1614b6b53
+F src/sqliteInt.h d8d69318b1ba3906d4860da1cd1c6b3650b81c9595e5bc360c6469a1e54e09e1
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -740,7 +740,7 @@ F test/capi3d.test aba917805573a03deed961a21f07a5a84505ad0a616f7e3fc1508844a15bc
F test/capi3e.test 3d49c01ef2a1a55f41d73cba2b23b5059ec460fe
F test/cast.test 2906ccab6a3ebd147ffa63304b635be903ce58264110d0a0eb4fd9939422bb53
F test/cffault.test 9d6b20606afe712374952eec4f8fd74b1a8097ef
-F test/check.test 9776af795bb5d0f197b7f8fe248052e3ca2ed35304d863efcdbf8b1316e11f65
+F test/check.test 4a2a91ed67eee84a6be16057c48d5198b6fb24849cd6da6cd855981de3fbb416
F test/checkfault.test da6cb3d50247169efcb20bdf57863a3ccfa1d27d9e55cd324f0680096970f014
F test/chunksize.test 427d87791743486cbf0c3b8c625002f3255cb3a89c6eba655a98923b1387b760
F test/close.test eccbad8ecd611d974cbf47278c3d4e5874faf02d811338d5d348af42d56d647c
@@ -759,8 +759,8 @@ F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6
F test/collateB.test 1e68906951b846570f29f20102ed91d29e634854ee47454d725f2151ecac0b95
F test/colmeta.test 2c765ea61ee37bc43bbe6d6047f89004e6508eb1
F test/colname.test 87ad5458bb8709312dac0d6755fd30e8e4ca83298d0a9ef6e5c24277a3c3390e
-F test/conflict.test 58857e2533fb9f2e0358ea7cb191215657846be1dd9da3b3d6df3e750c02ae03
-F test/conflict2.test bb0b94cf7196c64a3cbd815c66d3ee98c2fecd9c
+F test/conflict.test ac0667090f66130ac77d5fb764655558ca6600dd6d88f670ca9123b61c448337
+F test/conflict2.test 5557909ce683b1073982f5d1b61dfb1d41e369533bfdaf003180c5bc87282dd1
F test/conflict3.test 81865d9599609aca394fb3b9cd5f561d4729ea5b176bece3644f6ecb540f88ac
F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4
F test/corrupt.test d7cb0300e4a297147b6a05e92a1684bc8973635c3bcaa3d66e983c9cbdbf47a3
@@ -807,7 +807,7 @@ F test/cursorhint.test 0175e4404181ace3ceca8b114eb0a98eae600d565aa4e2705abbe6614
F test/cursorhint2.test 6f3aa9cb19e7418967a10ec6905209bcbb5968054da855fc36c8beee9ae9c42f
F test/dataversion1.test 6e5e86ac681f0782e766ebcb56c019ae001522d114e0e111e5ebf68ccf2a7bb8
F test/date.test 9b73bbeb1b82d9c1f44dec5cf563bf7da58d2373
-F test/date2.test 5ef8265c71460cda6b1698bf18f4bb0ffb40ac08c5092f6afe84d398c2feb5be
+F test/date2.test 520a1708e4e14c682cf514560f3e9f2e5affa9d66560fbc2a6941ae291260daf
F test/dbdata.test 042f49acff3438f940eeba5868d3af080ae64ddf26ae78f80c92bec3ca7d8603
F test/dbfuzz.c 73047c920d6210e5912c87cdffd9a1c281d4252e
F test/dbfuzz001.test 55e1a3504f8dea84155e09912fe3b1c3ad77e0b1a938ec42ca03b8e51b321e30
@@ -835,7 +835,7 @@ F test/e_blobclose.test 4b3c8c60c2171164d472059c73e9f3c1844bb66d
F test/e_blobopen.test e95e1d40f995056f6f322cd5e1a1b83a27e1a145
F test/e_blobwrite.test f87ff598b67af5b3ec002a8d83e804dc8d23808e88cf0080c176612fc9ffce14
F test/e_changes.test fd66105385153dbf21fdb35eb8ef6c3e1eade579
-F test/e_createtable.test ea27082d6f84df61e1d9e383f3fd79220418856a4a8afc41af75d458b8e7ac33
+F test/e_createtable.test 7107f5deda2324ea12dbf105044dc9265195401e9dbb3eead6a2c1a3da4bb5b7
F test/e_delete.test ab39084f26ae1f033c940b70ebdbbd523dc4962e
F test/e_droptrigger.test 235c610f8bf8ec44513e222b9085c7e49fad65ad0c1975ac2577109dd06fd8fa
F test/e_dropview.test 74e405df7fa0f762e0c9445b166fe03955856532e2bb234c372f7c51228d75e7
@@ -879,7 +879,7 @@ F test/filter2.tcl 44e525497ce07382915f01bd29ffd0fa49dab3adb87253b5e5103ba8f9339
F test/filter2.test 485cf95d1f6d6ceee5632201ca52a71868599836f430cdee42e5f7f14666e30a
F test/filterfault.test c08fb491d698e8df6c122c98f7db1c65ffcfcad2c1ab0e07fa8a5be1b34eaa8b
F test/fkey1.test d11dbb8a93ead9b5c46ae5d02da016d61245d47662fb2d844c99214f6163f768
-F test/fkey2.test b1b6a8c5556dc0ccf31291b1fed8aa57e404b38f3236110e19ab4dc6aa93edf2
+F test/fkey2.test 1063d65e5923c054cfb8f0555a92a3ae0fa8c067275a33ee1715bd856cdb304c
F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49
F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
F test/fkey5.test 6727452e163a427147e84e739da18713da553d79f9783559b04fdcd36d5c7421
@@ -1017,7 +1017,7 @@ F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d
F test/func.test f673822636fb8ed618dd2b80230d16e495d19c8f2e2e7d6c22e93e2b3de097ad
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
F test/func3.test 2bb0f31ab7baaed690b962a88544d7be6b34fa389364bc36a44e441ed3e3f1e6
-F test/func4.test a94858a8c1f10a408b0b3db439c990b59dbb2349411d503de011ac4e2b5f27a6
+F test/func4.test 2285fb5792d593fef442358763f0fd9de806eda47dbc7a5934df57ffdc484c31
F test/func5.test 863e6d1bd0013d09c17236f8a13ea34008dd857d87d85a13a673960e4c25d82a
F test/func6.test 90e42b64c4f9fb6f04f44cb8a1da586c8542502e926b19c76504fe74ff2a9b7c
F test/fuzz-oss1.test e58330d01cbbd8215ee636b17a03fe220b37dbfa
@@ -1050,7 +1050,7 @@ F test/hook2.test b9ff3b8c6519fb67f33192f1afe86e7782ee4ac8
F test/icu.test 716a6b89fbabe5cc63e0cd4c260befb08fd7b9d761f04d43669233292f0753b1
F test/ieee754.test b0945d12be7d255f3dfa18e2511b17ca37e0edd2b803231c52d05b86c04ab26e
F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8
-F test/in.test 95a704448eaa348300a517df267b37488c854aa0713125f4fa7b6280cfd4ed0f
+F test/in.test 688ed2011d922d83141a45af431601738674a4c0bdde34b6351f688b82a169b3
F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
F test/in4.test 65460600d48933adba4283c6ebd089aae173d16136ab9d01f74c89089090c5a5
@@ -1084,7 +1084,7 @@ F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
F test/insert.test 4e3f0de67aac3c5be1f4aaedbcea11638f1b5cdc9a3115be14d19aa9db7623c6
F test/insert2.test 4d14b8f1b810a41995f6286b64a6943215d52208
F test/insert3.test 1b7db95a03ad9c5013fdf7d6722b6cd66ee55e30
-F test/insert4.test fb9e0f752c75f453555990250b449f6d123ae6a3ebf054d14e4470de4498dce3
+F test/insert4.test 59cb99521be01a5aefc9be8e8b5a51ee7f3944781d4d7f6201b9f774fcd51662
F test/insert5.test 394f96728d1258f406fe5f5aeb0aaf29487c39a6
F test/insertfault.test ac63d14ea3b49c573673a572f4014b9117383a03e497c58f308b5c776e4a7f74
F test/instr.test 107df2b9b74a4b59315916b575590a08f2a714de0754abe541f10a0971d0a2a4
@@ -1101,7 +1101,7 @@ F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c
F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b
-F test/istrue.test 06f92ea38750fa74df7dbbe6920205251c2310861fbbe23a3adfa918a2e2ba74
+F test/istrue.test 9619a2d77580f676048aaff7a16a0bcfea2b96c6c660dfaded2e53c873418899
F test/join.test bca044589e94bb466e4c1e91fb6fecdc3f3326ca6b3f590f555f1958156eb321
F test/join2.test 21fc30e54ab35ed66bf51b89cec18729205497f5cc43c83bc042f96a73721593
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
@@ -1230,7 +1230,7 @@ F test/oserror.test 1fc9746b83d778e70d115049747ba19c7fba154afce7cc165b09feb6ca6a
F test/ossfuzz.c 9636dad2092a05a32110df0ca06713038dd0c43dd89a77dabe4b8b0d71096715
F test/ossshell.c f125c5bd16e537a2549aa579b328dd1c59905e7ab1338dfc210e755bb7b69f17
F test/ovfl.test 199c482696defceacee8c8e0e0ef36da62726b2f
-F test/pager1.test 4fba160bf450cea19f6bf1d6483ef467545bac6405570e176c83c2c4b5d6d0d5
+F test/pager1.test 293c7ad1f19a07e548179b97534c6588249d4e40058b378ea26e75cc84d936f5
F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71
F test/pager3.test 4e9a83d6ca0838d7c602c9eb93d1357562d9059c1e02ffb138a8271020838370
F test/pager4.test a122e9e6925d5b23b31e3dfef8c6a44bbf19590e
@@ -1262,7 +1262,7 @@ F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26
F test/quota.test bfb269ce81ea52f593f9648316cd5013d766dd2a
F test/quota2.test 7dc12e08b11cbc4c16c9ba2aa2e040ea8d8ab4b8
-F test/quote.test 626149eda89ee64d81a3790de370f9f0211921b11568a49c28c861f394330508
+F test/quote.test 3f9238ab0e1db70dea89af9afa5859dbd759b0ce0a63da67d547553e2c316475
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
@@ -1763,9 +1763,9 @@ F test/with2.test e0030e2f0267a910d6c0e4f46f2dfe941c1cc0d4f659ba69b3597728e7e8f1
F test/with3.test 13b3336739da648a9e4dfa11bb04e73a920c97620041007c5f75d5d14084c346
F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f198205
F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
-F test/without_rowid1.test 9cfb83705c506e3849fa7efc88a3c9a15f9a50bf9b1516b41757a7cef9bba8c3
+F test/without_rowid1.test e4034c0849ccc2e8bb749c69f15bd69bb9fcf8fe77e8d17ce02369604242fe83
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
-F test/without_rowid3.test 96426a6c9a2a5cf62bbe55ea1ad038eaaf4bf743f40a1ad517233b8e5a3d4339
+F test/without_rowid3.test 39ab0dd773eaa62e59b17093f875327630f54c4145458f6d2b053d68d4b2f67b
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
F test/without_rowid5.test 89b1c587bd92a0590e440da33e7666bf4891572a
F test/without_rowid6.test 8463b20098e9f75a501a9f17dfb42fffc79068eac0b2775fe56ef2281d2df45e
@@ -1879,7 +1879,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 f7f13cb1bc699c034a3f5f7a2431c8055cb79e2a14d5e70e1fc5dd6dec00fb26
-R 8121e5cf7bd833473b2f967ba76c7018
+P aafb7a21041090e529491b0ce30c3902420be0551b1b2c55840a5fbb9105fb7d
+R defd5bcc88d7bea7e7e35dc7f6baddf6
U drh
-Z 55de9e911e5f0e6470b6e0d616339b8e
+Z 54c7264672e91f2f8c6e93ebf30dc6e3
diff --git a/manifest.uuid b/manifest.uuid
index 721b77cdcf..192459b530 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-aafb7a21041090e529491b0ce30c3902420be0551b1b2c55840a5fbb9105fb7d
\ No newline at end of file
+5ce34a955bb36d77edc9951cb7ac2ef9c876d7d3ff5852af682f558e248f428c
\ No newline at end of file
diff --git a/src/build.c b/src/build.c
index d0086c3c0c..1597f8bc33 100644
--- a/src/build.c
+++ b/src/build.c
@@ -1617,8 +1617,10 @@ primary_key_exit:
** Add a new CHECK constraint to the table currently under construction.
*/
void sqlite3AddCheckConstraint(
- Parse *pParse, /* Parsing context */
- Expr *pCheckExpr /* The check expression */
+ Parse *pParse, /* Parsing context */
+ Expr *pCheckExpr, /* The check expression */
+ const char *zStart, /* Opening "(" */
+ const char *zEnd /* Closing ")" */
){
#ifndef SQLITE_OMIT_CHECK
Table *pTab = pParse->pNewTable;
@@ -1629,6 +1631,13 @@ void sqlite3AddCheckConstraint(
pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
if( pParse->constraintName.n ){
sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
+ }else{
+ Token t;
+ for(zStart++; sqlite3Isspace(zStart[0]); zStart++){}
+ while( sqlite3Isspace(zEnd[-1]) ){ zEnd--; }
+ t.z = zStart;
+ t.n = (int)(zEnd - t.z);
+ sqlite3ExprListSetName(pParse, pTab->pCheck, &t, 1);
}
}else
#endif
diff --git a/src/parse.y b/src/parse.y
index 44e0b4f343..c44d6563a4 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -366,7 +366,7 @@ ccons ::= PRIMARY KEY sortorder(Z) onconf(R) autoinc(I).
{sqlite3AddPrimaryKey(pParse,0,R,I,Z);}
ccons ::= UNIQUE onconf(R). {sqlite3CreateIndex(pParse,0,0,0,0,R,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
-ccons ::= CHECK LP expr(X) RP. {sqlite3AddCheckConstraint(pParse,X);}
+ccons ::= CHECK LP(A) expr(X) RP(B). {sqlite3AddCheckConstraint(pParse,X,A.z,B.z);}
ccons ::= REFERENCES nm(T) eidlist_opt(TA) refargs(R).
{sqlite3CreateForeignKey(pParse,0,&T,TA,R);}
ccons ::= defer_subclause(D). {sqlite3DeferForeignKey(pParse,D);}
@@ -420,8 +420,8 @@ tcons ::= PRIMARY KEY LP sortlist(X) autoinc(I) RP onconf(R).
tcons ::= UNIQUE LP sortlist(X) RP onconf(R).
{sqlite3CreateIndex(pParse,0,0,0,X,R,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
-tcons ::= CHECK LP expr(E) RP onconf.
- {sqlite3AddCheckConstraint(pParse,E);}
+tcons ::= CHECK LP(A) expr(E) RP(B) onconf.
+ {sqlite3AddCheckConstraint(pParse,E,A.z,B.z);}
tcons ::= FOREIGN KEY LP eidlist(FA) RP
REFERENCES nm(T) eidlist_opt(TA) refargs(R) defer_subclause_opt(D). {
sqlite3CreateForeignKey(pParse, FA, &T, TA, R);
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index f2c4f63c0d..9afc287a5b 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -4184,7 +4184,7 @@ void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
void sqlite3AddColumn(Parse*,Token*,Token*);
void sqlite3AddNotNull(Parse*, int);
void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
-void sqlite3AddCheckConstraint(Parse*, Expr*);
+void sqlite3AddCheckConstraint(Parse*, Expr*, const char*, const char*);
void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*);
void sqlite3AddCollateType(Parse*, Token*);
void sqlite3AddGenerated(Parse*,Expr*,Token*);
diff --git a/test/check.test b/test/check.test
index d28006e38f..94fe1d14e4 100644
--- a/test/check.test
+++ b/test/check.test
@@ -40,7 +40,7 @@ do_test check-1.3 {
catchsql {
INSERT INTO t1 VALUES(6,7);
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: x<5}}
do_test check-1.4 {
execsql {
SELECT * FROM t1;
@@ -50,7 +50,7 @@ do_test check-1.5 {
catchsql {
INSERT INTO t1 VALUES(4,3);
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: y>x}}
do_test check-1.6 {
execsql {
SELECT * FROM t1;
@@ -87,7 +87,7 @@ do_test check-1.12 {
catchsql {
UPDATE t1 SET x=7 WHERE x==2
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: x<5}}
do_test check-1.13 {
execsql {
SELECT * FROM t1;
@@ -97,7 +97,7 @@ do_test check-1.14 {
catchsql {
UPDATE t1 SET x=5 WHERE x==2
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: x<5}}
do_test check-1.15 {
execsql {
SELECT * FROM t1;
@@ -186,7 +186,7 @@ do_test check-2.11 {
catchsql {
INSERT INTO t2b VALUES('xyzzy','hi',5);
}
-} {1 {CHECK constraint failed: t2b}}
+} {1 {CHECK constraint failed: typeof(coalesce(x,0))=='integer'}}
do_test check-2.12 {
execsql {
CREATE TABLE t2c(
@@ -271,7 +271,7 @@ do_test check-3.9 {
catchsql {
INSERT INTO t3 VALUES(111,222,333);
}
-} {1 {CHECK constraint failed: t3}}
+} {1 {CHECK constraint failed: t3.x<25}}
do_test check-4.1 {
execsql {
@@ -313,7 +313,10 @@ do_test check-4.6 {
catchsql {
UPDATE t4 SET x=0, y=1;
}
-} {1 {CHECK constraint failed: t4}}
+} {1 {CHECK constraint failed: x+y==11
+ OR x*y==12
+ OR x/y BETWEEN 5 AND 8
+ OR -x==y+10}}
do_test check-4.7 {
execsql {
SELECT * FROM t4;
@@ -335,7 +338,10 @@ do_test check-4.9 {
catchsql {
UPDATE t4 SET x=0, y=2;
}
-} {1 {CHECK constraint failed: t4}}
+} {1 {CHECK constraint failed: x+y==11
+ OR x*y==12
+ OR x/y BETWEEN 5 AND 8
+ OR -x==y+10}}
ifcapable vacuum {
do_test check_4.10 {
catchsql {
@@ -386,7 +392,7 @@ do_test check-6.5 {
catchsql {
UPDATE OR FAIL t1 SET x=7-x, y=y+1;
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: x<5}}
do_test check-6.6 {
execsql {
SELECT * FROM t1;
@@ -398,7 +404,7 @@ do_test check-6.7 {
INSERT INTO t1 VALUES(1,30.0);
INSERT OR ROLLBACK INTO t1 VALUES(8,40.0);
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: x<5}}
do_test check-6.8 {
catchsql {
COMMIT;
@@ -417,7 +423,7 @@ do_test check-6.12 {
catchsql {
REPLACE INTO t1 VALUES(6,7);
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: x<5}}
do_test check-6.13 {
execsql {SELECT * FROM t1}
} {3 12.0 2 20.0}
@@ -446,7 +452,7 @@ db func myfunc -deterministic myfunc
do_execsql_test 7.1 { CREATE TABLE t6(a CHECK (myfunc(a))) }
do_execsql_test 7.2 { INSERT INTO t6 VALUES(9) }
do_catchsql_test 7.3 { INSERT INTO t6 VALUES(11) } \
- {1 {CHECK constraint failed: t6}}
+ {1 {CHECK constraint failed: myfunc(a)}}
do_test 7.4 {
sqlite3 db2 test.db
@@ -469,7 +475,7 @@ do_test 7.7 {
do_test 7.8 {
db2 func myfunc myfunc
catchsql { INSERT INTO t6 VALUES(12) } db2
-} {1 {CHECK constraint failed: t6}}
+} {1 {CHECK constraint failed: myfunc(a)}}
# 2013-08-02: Silently ignore database name qualifiers in CHECK constraints.
#
@@ -550,10 +556,10 @@ do_execsql_test 12.20 {
} {}
do_catchsql_test 12.21 {
INSERT INTO t1(a) VALUES('xyz');
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: a<>+a}}
do_catchsql_test 12.22 {
INSERT INTO t1(a) VALUES(123);
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: a<>+a}}
do_execsql_test 12.30 {
DROP TABLE t1;
CREATE TABLE t1(a TEXT, CHECK(NOT(a=+a)));
@@ -561,10 +567,10 @@ do_execsql_test 12.30 {
} {}
do_catchsql_test 12.31 {
INSERT INTO t1(a) VALUES('xyz');
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: NOT(a=+a)}}
do_catchsql_test 12.32 {
INSERT INTO t1(a) VALUES(123);
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: NOT(a=+a)}}
do_execsql_test 12.40 {
DROP TABLE t1;
CREATE TABLE t1(a TEXT, CHECK(NOT(a<>+a)));
@@ -585,7 +591,7 @@ do_execsql_test 12.60 {
} {NULL}
do_catchsql_test 12.61 {
INSERT INTO t1(a) VALUES(456);
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: a NOT BETWEEN 0 AND +a}}
do_execsql_test 12.70 {
DROP TABLE t1;
CREATE TABLE t1(a TEXT, CHECK(a BETWEEN +a AND 999999));
@@ -600,6 +606,6 @@ do_execsql_test 12.80 {
} {NULL}
do_catchsql_test 12.81 {
INSERT INTO t1(a) VALUES(456);
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: a NOT BETWEEN +a AND 999999}}
finish_test
diff --git a/test/conflict.test b/test/conflict.test
index b86f86022b..e0d0c87ece 100644
--- a/test/conflict.test
+++ b/test/conflict.test
@@ -813,7 +813,7 @@ do_test conflict-13.1 {
catchsql {
REPLACE INTO t13 VALUES(2);
}
-} {1 {CHECK constraint failed: t13}}
+} {1 {CHECK constraint failed: a!=2}}
verify_ex_errcode conflict-13.1b SQLITE_CONSTRAINT_CHECK
do_test conflict-13.2 {
execsql {
diff --git a/test/conflict2.test b/test/conflict2.test
index f33e01d582..96289d38ca 100644
--- a/test/conflict2.test
+++ b/test/conflict2.test
@@ -811,7 +811,7 @@ do_test conflict2-13.1 {
catchsql {
REPLACE INTO t13 VALUES(2);
}
-} {1 {CHECK constraint failed: t13}}
+} {1 {CHECK constraint failed: a!=2}}
verify_ex_errcode conflict2-13.1b SQLITE_CONSTRAINT_CHECK
do_test conflict2-13.2 {
execsql {
diff --git a/test/date2.test b/test/date2.test
index 820420ccf5..30a4757378 100644
--- a/test/date2.test
+++ b/test/date2.test
@@ -36,7 +36,7 @@ do_execsql_test date2-120 {
} {2017-07-20 one}
do_catchsql_test date2-130 {
INSERT INTO t1(x,y) VALUES('2017-08-01','two');
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: date(x) BETWEEN '2017-07-01' AND '2017-07-31'}}
do_execsql_test date2-200 {
CREATE TABLE t2(x,y);
@@ -138,7 +138,7 @@ do_catchsql_test date2-601 {
} {0 {}}
do_catchsql_test date2-602 {
INSERT INTO t601(a,b) VALUES(1e100, '1970-01-01');
-} {1 {CHECK constraint failed: t601}}
+} {1 {CHECK constraint failed: a0}
+ 1b "INSERT INTO t1 VALUES('one', -4.0)" {b>0}
- 2a "INSERT INTO x2 VALUES('abc', 1)" {x2}
- 2b "INSERT INTO t2 VALUES('abc', 1)" {t2}
+ 2a "INSERT INTO x2 VALUES('abc', 1)" {a||b}
+ 2b "INSERT INTO t2 VALUES('abc', 1)" {a||b}
- 3a "INSERT INTO x2 VALUES(0, 'abc')" {x2}
- 3b "INSERT INTO t2 VALUES(0, 'abc')" {t2}
+ 3a "INSERT INTO x2 VALUES(0, 'abc')" {a||b}
+ 3b "INSERT INTO t2 VALUES(0, 'abc')" {a||b}
- 4a "UPDATE t1 SET b=-1 WHERE rowid=1" {t1}
- 4b "UPDATE x1 SET b=-1 WHERE rowid=1" {x1}
+ 4a "UPDATE t1 SET b=-1 WHERE rowid=1" {b>0}
+ 4b "UPDATE x1 SET b=-1 WHERE rowid=1" {b>0}
- 4a "UPDATE x2 SET a='' WHERE rowid=1" {x2}
- 4b "UPDATE t2 SET a='' WHERE rowid=1" {t2}
+ 4a "UPDATE x2 SET a='' WHERE rowid=1" {a||b}
+ 4b "UPDATE t2 SET a='' WHERE rowid=1" {a||b}
}
# EVIDENCE-OF: R-34109-39108 If the CHECK expression evaluates to NULL,
@@ -1639,7 +1639,7 @@ do_execsql_test 4.18.1 {
do_execsql_test 4.18.2 { BEGIN; INSERT INTO t4 VALUES(5, 6) }
do_catchsql_test 4.18.3 {
INSERT INTO t4 SELECT a+4, b+4 FROM t4
-} {1 {CHECK constraint failed: t4}}
+} {1 {CHECK constraint failed: b!=10}}
do_test e_createtable-4.18.4 { sqlite3_get_autocommit db } 0
do_execsql_test 4.18.5 { SELECT * FROM t4 } {1 2 3 4 5 6}
diff --git a/test/fkey2.test b/test/fkey2.test
index 015c43cbd3..6f9bdc2b7c 100644
--- a/test/fkey2.test
+++ b/test/fkey2.test
@@ -417,14 +417,14 @@ do_test fkey2-3.1.2 {
} {}
do_test fkey2-3.1.3 {
catchsql { UPDATE ab SET a = 5 }
-} {1 {CHECK constraint failed: ef}}
+} {1 {CHECK constraint failed: e!=5}}
do_test fkey2-3.1.4 {
execsql { SELECT * FROM ab }
} {1 b}
do_test fkey2-3.1.4 {
execsql BEGIN;
catchsql { UPDATE ab SET a = 5 }
-} {1 {CHECK constraint failed: ef}}
+} {1 {CHECK constraint failed: e!=5}}
do_test fkey2-3.1.5 {
execsql COMMIT;
execsql { SELECT * FROM ab; SELECT * FROM cd; SELECT * FROM ef }
diff --git a/test/func4.test b/test/func4.test
index fe7d042c27..924c1fa538 100644
--- a/test/func4.test
+++ b/test/func4.test
@@ -381,32 +381,32 @@ ifcapable check {
catchsql {
INSERT INTO t1 (x) VALUES (NULL);
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.3 {
catchsql {
INSERT INTO t1 (x) VALUES (NULL);
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.4 {
catchsql {
INSERT INTO t1 (x) VALUES ('');
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.5 {
catchsql {
INSERT INTO t1 (x) VALUES ('bad');
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.6 {
catchsql {
INSERT INTO t1 (x) VALUES ('1234bad');
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.7 {
catchsql {
INSERT INTO t1 (x) VALUES ('1234.56bad');
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.8 {
catchsql {
INSERT INTO t1 (x) VALUES (1234);
@@ -416,7 +416,7 @@ ifcapable check {
catchsql {
INSERT INTO t1 (x) VALUES (1234.56);
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.10 {
catchsql {
INSERT INTO t1 (x) VALUES ('1234');
@@ -426,27 +426,27 @@ ifcapable check {
catchsql {
INSERT INTO t1 (x) VALUES ('1234.56');
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.12 {
catchsql {
INSERT INTO t1 (x) VALUES (ZEROBLOB(4));
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.13 {
catchsql {
INSERT INTO t1 (x) VALUES (X'');
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.14 {
catchsql {
INSERT INTO t1 (x) VALUES (X'1234');
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.15 {
catchsql {
INSERT INTO t1 (x) VALUES (X'12345678');
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
do_test func4-3.16 {
catchsql {
INSERT INTO t1 (x) VALUES ('1234.00');
@@ -467,7 +467,7 @@ ifcapable check {
catchsql {
INSERT INTO t1 (x) VALUES (9223372036854775808);
}
- } {1 {CHECK constraint failed: t1}}
+ } {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
}
do_execsql_test func4-3.20 {
SELECT x FROM t1 WHERE x>0 ORDER BY x;
@@ -483,32 +483,32 @@ ifcapable check {
catchsql {
INSERT INTO t2 (x) VALUES (NULL);
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.3 {
catchsql {
INSERT INTO t2 (x) VALUES (NULL);
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.4 {
catchsql {
INSERT INTO t2 (x) VALUES ('');
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.5 {
catchsql {
INSERT INTO t2 (x) VALUES ('bad');
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.6 {
catchsql {
INSERT INTO t2 (x) VALUES ('1234bad');
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.7 {
catchsql {
INSERT INTO t2 (x) VALUES ('1234.56bad');
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.8 {
catchsql {
INSERT INTO t2 (x) VALUES (1234);
@@ -533,22 +533,22 @@ ifcapable check {
catchsql {
INSERT INTO t2 (x) VALUES (ZEROBLOB(4));
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.13 {
catchsql {
INSERT INTO t2 (x) VALUES (X'');
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.14 {
catchsql {
INSERT INTO t2 (x) VALUES (X'1234');
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_test func4-4.15 {
catchsql {
INSERT INTO t2 (x) VALUES (X'12345678');
}
- } {1 {CHECK constraint failed: t2}}
+ } {1 {CHECK constraint failed: toreal(x) IS NOT NULL}}
do_execsql_test func4-4.16 {
SELECT x FROM t2 ORDER BY x;
} {1234.0 1234.0 1234.56 1234.56}
diff --git a/test/in.test b/test/in.test
index f09c52f9f7..efbfbd0379 100644
--- a/test/in.test
+++ b/test/in.test
@@ -332,7 +332,7 @@ do_test in-10.2 {
catchsql {
INSERT INTO t5 VALUES(4);
}
-} {1 {CHECK constraint failed: t5}}
+} {1 {CHECK constraint failed: a IN (111,222,333)}}
# Ticket #1821
#
diff --git a/test/insert4.test b/test/insert4.test
index 4c6a6d4a6c..3eca60a84d 100644
--- a/test/insert4.test
+++ b/test/insert4.test
@@ -55,7 +55,7 @@ do_test insert4-1.1 {
catchsql {
INSERT INTO t1 SELECT * FROM t2;
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: b>a}}
xferopt_test insert4-1.2 0
do_test insert4-1.3 {
execsql {
@@ -102,7 +102,7 @@ do_test insert4-2.3.3 {
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
SELECT * FROM t1;
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: b>a}}
xferopt_test insert4-2.3.4 0
# Do not run the transfer optimization if there is a DISTINCT
@@ -120,7 +120,7 @@ do_test insert4-2.4.3 {
DELETE FROM t1;
INSERT INTO t1 SELECT DISTINCT * FROM t2;
}
-} {1 {CHECK constraint failed: t1}}
+} {1 {CHECK constraint failed: b>a}}
xferopt_test insert4-2.4.4 0
# The following procedure constructs two tables then tries to transfer
@@ -316,7 +316,7 @@ do_test insert4-6.6 {
catchsql {
INSERT INTO t6b SELECT * FROM t6a;
}
-} {1 {CHECK constraint failed: t6b}}
+} {1 {CHECK constraint failed: x<>'abc' COLLATE nocase}}
do_test insert4-6.7 {
execsql {
DROP TABLE t6b;
@@ -325,7 +325,7 @@ do_test insert4-6.7 {
catchsql {
INSERT INTO t6b SELECT * FROM t6a;
}
-} {1 {CHECK constraint failed: t6b}}
+} {1 {CHECK constraint failed: x COLLATE nocase <>'abc'}}
# Ticket [6284df89debdfa61db8073e062908af0c9b6118e]
# Disable the xfer optimization if the destination table contains
diff --git a/test/istrue.test b/test/istrue.test
index b2f5b8d22b..13eccabc25 100644
--- a/test/istrue.test
+++ b/test/istrue.test
@@ -112,16 +112,16 @@ do_execsql_test istrue-520 {
} {1 1 0 {} {}}
do_catchsql_test istrue-521 {
INSERT INTO t2 VALUES(2,false,false,null,null);
-} {1 {CHECK constraint failed: t2}}
+} {1 {CHECK constraint failed: b IS TRUE}}
do_catchsql_test istrue-522 {
INSERT INTO t2 VALUES(2,true,true,null,null);
-} {1 {CHECK constraint failed: t2}}
+} {1 {CHECK constraint failed: c IS FALSE}}
do_catchsql_test istrue-523 {
INSERT INTO t2 VALUES(2,true,false,true,null);
-} {1 {CHECK constraint failed: t2}}
+} {1 {CHECK constraint failed: d IS NOT TRUE}}
do_catchsql_test istrue-524 {
INSERT INTO t2 VALUES(2,true,false,null,false);
-} {1 {CHECK constraint failed: t2}}
+} {1 {CHECK constraint failed: e IS NOT FALSE}}
foreach {tn val} [list 1 NaN 2 -NaN 3 NaN0 4 -NaN0 5 Inf 6 -Inf] {
do_execsql_test istrue-600.$tn.1 {
@@ -193,7 +193,7 @@ do_execsql_test istrue-840 {
} {}
do_catchsql_test istrue-841 {
INSERT INTO False VALUES(5,6,7);
-} {1 {CHECK constraint failed: false}}
+} {1 {CHECK constraint failed: 5 IN (false.false)}}
do_execsql_test istrue-850 {
SELECT 9 IN (false.false) FROM false;
} {0}
diff --git a/test/pager1.test b/test/pager1.test
index 20fd8bd17a..5c3f7a8ea3 100644
--- a/test/pager1.test
+++ b/test/pager1.test
@@ -276,7 +276,7 @@ do_execsql_test pager1-3.1.2 {
} {3 0}
do_catchsql_test pager1-3.1.3 {
INSERT INTO t1 SELECT a+3, randomblob(1500) FROM t1
-} {1 {CHECK constraint failed: counter}}
+} {1 {CHECK constraint failed: i<5}}
do_execsql_test pager1-3.4 { SELECT * FROM counter } {3 0}
do_execsql_test pager1-3.5 { SELECT a FROM t1 } {1 2 3}
do_execsql_test pager1-3.6 { COMMIT } {}
diff --git a/test/quote.test b/test/quote.test
index a7477087c0..553e96a0b6 100644
--- a/test/quote.test
+++ b/test/quote.test
@@ -122,7 +122,7 @@ do_execsql_test 2.3.1 {
}
do_catchsql_test 2.3.2 {
INSERT INTO xyz VALUES(1, 2, 'null');
-} {1 {CHECK constraint failed: xyz}}
+} {1 {CHECK constraint failed: c!="null"}}
do_execsql_test 2.4 {
INSERT INTO t1 VALUES(1, 2, 3);
diff --git a/test/without_rowid1.test b/test/without_rowid1.test
index 3497ca0ccc..02a089610d 100644
--- a/test/without_rowid1.test
+++ b/test/without_rowid1.test
@@ -341,7 +341,7 @@ do_execsql_test 7.1 {
} {}
do_catchsql_test 7.2 {
INSERT INTO t70a(rowid,a,b) VALUES(33,99,'xyzzy');
-} {1 {CHECK constraint failed: t70a}}
+} {1 {CHECK constraint failed: rowid!=33}}
do_catchsql_test 7.3 {
CREATE TABLE t70b(
a INT CHECK( rowid!=33 ),
diff --git a/test/without_rowid3.test b/test/without_rowid3.test
index eae7e3c856..f7687455ec 100644
--- a/test/without_rowid3.test
+++ b/test/without_rowid3.test
@@ -417,14 +417,14 @@ do_test without_rowid3-3.1.2 {
} {}
do_test without_rowid3-3.1.3 {
catchsql { UPDATE ab SET a = 5 }
-} {1 {CHECK constraint failed: ef}}
+} {1 {CHECK constraint failed: e!=5}}
do_test without_rowid3-3.1.4 {
execsql { SELECT * FROM ab }
} {1 b}
do_test without_rowid3-3.1.4 {
execsql BEGIN;
catchsql { UPDATE ab SET a = 5 }
-} {1 {CHECK constraint failed: ef}}
+} {1 {CHECK constraint failed: e!=5}}
do_test without_rowid3-3.1.5 {
execsql COMMIT;
execsql { SELECT * FROM ab; SELECT * FROM cd; SELECT * FROM ef }
From 04cd60e18cc6bae970197d5ec799903bea16412b Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 27 Aug 2020 20:55:54 +0000
Subject: [PATCH 035/169] Remove a (harmless) redundant variable from the CLI
implementation.
FossilOrigin-Name: 3f7bbb840de0a9b1ca89288805cb151aea6fcb82efda9ba39f51abf1b17c070b
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/shell.c.in | 1 -
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 75c9acebcb..20b1276cb1 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Include\sthe\soriginal\stext\sof\sthe\sCHECK\sconstraint\sin\sthe\serror\smessage\sfor\nanonymous\sCHECK\sconstraints.
-D 2020-08-27T18:36:30.231
+C Remove\sa\s(harmless)\sredundant\svariable\sfrom\sthe\sCLI\simplementation.
+D 2020-08-27T20:55:54.794
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -536,7 +536,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
-F src/shell.c.in d9aae37f76cc45b4ef6e8949979dbd124f9e5031789116c85d1aca396a37a403
+F src/shell.c.in ee40209106b1f12e1ae803deb427f7ab153bd7ab6fed16ed3ba8b6a6d1fa74d5
F src/sqlite.h.in b91e4a5b9b25eb95260be0bf9716d2bdba0da06b72eb439f41592b226f58881d
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1879,7 +1879,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 aafb7a21041090e529491b0ce30c3902420be0551b1b2c55840a5fbb9105fb7d
-R defd5bcc88d7bea7e7e35dc7f6baddf6
+P 5ce34a955bb36d77edc9951cb7ac2ef9c876d7d3ff5852af682f558e248f428c
+R 4c31632b33af6dfe406fad41b7f733eb
U drh
-Z 54c7264672e91f2f8c6e93ebf30dc6e3
+Z 3ce2eed8cce1cd5dc3d8c2d5bd0d59bb
diff --git a/manifest.uuid b/manifest.uuid
index 192459b530..14ff970d8d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5ce34a955bb36d77edc9951cb7ac2ef9c876d7d3ff5852af682f558e248f428c
\ No newline at end of file
+3f7bbb840de0a9b1ca89288805cb151aea6fcb82efda9ba39f51abf1b17c070b
\ No newline at end of file
diff --git a/src/shell.c.in b/src/shell.c.in
index d70ee318b9..aef7e85d37 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -7586,7 +7586,6 @@ static int do_meta_command(char *zLine, ShellState *p){
char **azName = 0;
int nName = 0;
sqlite3_stmt *pStmt;
- int rc;
int i;
open_db(p, 0);
rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
From 832aa023c600c59c1769cce013ab6ced488300d0 Mon Sep 17 00:00:00 2001
From: dan
Date: Fri, 28 Aug 2020 11:19:49 +0000
Subject: [PATCH 036/169] Add fts5 test to confirm that for a table with
columns a, b, c and d, "{a b}" and "-{c d}" are handled similarly.
FossilOrigin-Name: 1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
---
ext/fts5/fts5_expr.c | 11 +++++++++--
ext/fts5/test/fts5colset.test | 19 +++++++++++++++++++
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
4 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/ext/fts5/fts5_expr.c b/ext/fts5/fts5_expr.c
index d9de1c8178..01be61da35 100644
--- a/ext/fts5/fts5_expr.c
+++ b/ext/fts5/fts5_expr.c
@@ -2401,8 +2401,15 @@ static char *fts5ExprPrint(Fts5Config *pConfig, Fts5ExprNode *pExpr){
int iTerm;
if( pNear->pColset ){
- int iCol = pNear->pColset->aiCol[0];
- zRet = fts5PrintfAppend(zRet, "%s : ", pConfig->azCol[iCol]);
+ int ii;
+ Fts5Colset *pColset = pNear->pColset;
+ if( pColset->nCol>1 ) zRet = fts5PrintfAppend(zRet, "{");
+ for(ii=0; iinCol; ii++){
+ zRet = fts5PrintfAppend(zRet, "%s%s",
+ pConfig->azCol[pColset->aiCol[ii]], ii==pColset->nCol-1 ? "" : " "
+ );
+ }
+ zRet = fts5PrintfAppend(zRet, "%s : ", pColset->nCol>1 ? "}" : "");
if( zRet==0 ) return 0;
}
diff --git a/ext/fts5/test/fts5colset.test b/ext/fts5/test/fts5colset.test
index 74f23004ac..7243743b51 100644
--- a/ext/fts5/test/fts5colset.test
+++ b/ext/fts5/test/fts5colset.test
@@ -82,5 +82,24 @@ foreach_detail_mode $::testprefix {
} {1 {unable to use function MATCH in the requested context}}
}
+#-------------------------------------------------------------------------
+# Confirm that the expression parser creates the same expression tree
+# for:
+#
+# {a b} : (abc AND def)
+# -{c d} : (abc AND def)
+#
+# Assuming that the table columns are (a, b, c, d).
+#
+do_execsql_test 5.1 {
+ SELECT fts5_expr('abcd AND cdef');
+} {{"abcd" AND "cdef"}}
+do_execsql_test 5.2 {
+ SELECT fts5_expr('{a b} : (abcd AND cdef)', 'a', 'b', 'c', 'd');
+} {{{a b} : "abcd" AND {a b} : "cdef"}}
+do_execsql_test 5.3 {
+ SELECT fts5_expr('-{c d} : (abcd AND cdef)', 'a', 'b', 'c', 'd');
+} {{{a b} : "abcd" AND {a b} : "cdef"}}
+
finish_test
diff --git a/manifest b/manifest
index 20b1276cb1..abe12971e2 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sa\s(harmless)\sredundant\svariable\sfrom\sthe\sCLI\simplementation.
-D 2020-08-27T20:55:54.794
+C Add\sfts5\stest\sto\sconfirm\sthat\sfor\sa\stable\swith\scolumns\sa,\sb,\sc\sand\sd,\s"{a\sb}"\sand\s"-{c\sd}"\sare\shandled\ssimilarly.
+D 2020-08-28T11:19:49.438
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -116,7 +116,7 @@ F ext/fts5/fts5Int.h d7cbc214ee167496f70905667e18f73ea0402f7ef09236ce305e117e0ef
F ext/fts5/fts5_aux.c dcc627d8b6e3fc773db528ff67b39955dab7b51628f9dba8e15849e5bedfd7fa
F ext/fts5/fts5_buffer.c 5a5fe0159752c0fb0a5a93c722e9db2662822709490769d482b76a6dc8aaca70
F ext/fts5/fts5_config.c b447948f35ad3354e8fe5e242e0a7e7b5b941555400b9404259944e3aa570037
-F ext/fts5/fts5_expr.c 2be456484786333d559dc2987a00f2750981fab91d52db8452a8046278c5f22e
+F ext/fts5/fts5_expr.c 6393974bd3968280fa5275c26a41d837701d27793a2f025b9e7329bdbfbb274a
F ext/fts5/fts5_hash.c 1cc0095646f5f3b46721aa112fb4f9bf29ae175cb5338f89dcec66ed97acfe75
F ext/fts5/fts5_index.c de14c9a30f45e2b847ff9284b14776d9d07961e545e8f1546a6aa3f915af721f
F ext/fts5/fts5_main.c e881a2ea0bf01b3a3ff0bc1b31373c58fd54b6c9f3c43ea3d431bea4e5d4025e
@@ -151,7 +151,7 @@ F ext/fts5/test/fts5bigpl.test 6466c89b38439f0aba26ac09e232a6b963f29b1cbe1304f6a
F ext/fts5/test/fts5bigtok.test 541119e616c637caea925a8c028c37c2c29e94383e00aa2f9198d530724b6e36
F ext/fts5/test/fts5cat.test daba0b80659460b0cb60bd1f40b402478a761fe7ea414c3c94c2be25568cc33a
F ext/fts5/test/fts5circref.test f880dfd0d99f6fb73b88ccacb0927d18e833672fd906cc47d6b4e529419eaa62
-F ext/fts5/test/fts5colset.test a30473451321bbf0b6218af62e96b4ae5fa99931cfdb210b5ecc804623b30f75
+F ext/fts5/test/fts5colset.test 7031ce84fb4d312df5a99fc4e7b324e660ccb513c97eccdef469bfd52d3d0f8f
F ext/fts5/test/fts5columnsize.test 45459ce4dd9fd853b6044cdc9674921bff89e3d840f348ca8c1630f9edbf5482
F ext/fts5/test/fts5config.test 60094712debc59286c59aef0e6cf511c37d866802776a825ce437d26afe0817f
F ext/fts5/test/fts5conflict.test 655925678e630d3cdf145d18725a558971806416f453ac8410ca8c04d934238d
@@ -1879,7 +1879,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 5ce34a955bb36d77edc9951cb7ac2ef9c876d7d3ff5852af682f558e248f428c
-R 4c31632b33af6dfe406fad41b7f733eb
-U drh
-Z 3ce2eed8cce1cd5dc3d8c2d5bd0d59bb
+P 3f7bbb840de0a9b1ca89288805cb151aea6fcb82efda9ba39f51abf1b17c070b
+R 68183e6ade81d2ecd369f241c0d2a0e4
+U dan
+Z 8ead3559fc701c9e301c92555bb4b25a
diff --git a/manifest.uuid b/manifest.uuid
index 14ff970d8d..97978cf340 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-3f7bbb840de0a9b1ca89288805cb151aea6fcb82efda9ba39f51abf1b17c070b
\ No newline at end of file
+1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
\ No newline at end of file
From e2678b93afd46f7fa1b1ea2433333b751faac04b Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 28 Aug 2020 12:58:21 +0000
Subject: [PATCH 037/169] Fix a couple of unreachable branches.
FossilOrigin-Name: f2d26f2b11317abd4f993faa1a4df7afcd1a2d4e448ecc69ca05e9ebf102cd62
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
src/insert.c | 2 +-
src/printf.c | 9 ++++-----
4 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/manifest b/manifest
index abe12971e2..9d7a1f4ca0 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sfts5\stest\sto\sconfirm\sthat\sfor\sa\stable\swith\scolumns\sa,\sb,\sc\sand\sd,\s"{a\sb}"\sand\s"-{c\sd}"\sare\shandled\ssimilarly.
-D 2020-08-28T11:19:49.438
+C Fix\sa\scouple\sof\sunreachable\sbranches.
+D 2020-08-28T12:58:21.030
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -496,7 +496,7 @@ F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
F src/hash.h 9d56a9079d523b648774c1784b74b89bd93fac7b365210157482e4319a468f38
F src/hwtime.h cb1d7e3e1ed94b7aa6fde95ae2c2daccc3df826be26fc9ed7fd90d1750ae6144
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
-F src/insert.c 1103270dfc1a94d1ca69f36dc3e021a335459583195e4b9e5a4d6e3c840279ba
+F src/insert.c 7e081d33aab4a9d761c39dccf3c3872c35501565d2ed9db66301918d23bc7901
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
F src/main.c d71b989398a4cdb4e7ece0478b763834d7732fb78dd24702d36366743853ac82
@@ -531,7 +531,7 @@ F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
F src/pragma.c 5435b9fe17f7728bd460f52d6d9388e7e45658c6f5549f28fc2d408be9efd2d5
F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
F src/prepare.c 38ae9c2e3550bfa496886a862a5344c420ded052fd92294f409a07a53f372ffe
-F src/printf.c 9efcd4e984f22bcccb1ded37a1178cac98f6e3a0534e1e0629f64899971f8838
+F src/printf.c 30e92b638fac71dcd85cdea1d12ecfae354c9adee2c71e8e1ae4727cde7c91ed
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
@@ -1879,7 +1879,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 3f7bbb840de0a9b1ca89288805cb151aea6fcb82efda9ba39f51abf1b17c070b
-R 68183e6ade81d2ecd369f241c0d2a0e4
-U dan
-Z 8ead3559fc701c9e301c92555bb4b25a
+P 1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
+R 226559a22dbe15c2cb43501373224222
+U drh
+Z 999aada41f64ce3323554005b08290d8
diff --git a/manifest.uuid b/manifest.uuid
index 97978cf340..f21521198d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
\ No newline at end of file
+f2d26f2b11317abd4f993faa1a4df7afcd1a2d4e448ecc69ca05e9ebf102cd62
\ No newline at end of file
diff --git a/src/insert.c b/src/insert.c
index 7c89f33775..393cd528f1 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1686,7 +1686,7 @@ void sqlite3GenerateConstraintChecks(
sqlite3VdbeGoto(v, ignoreDest);
}else{
char *zName = pCheck->a[i].zEName;
- if( zName==0 ) zName = pTab->zName;
+ assert( zName!=0 || pParse->db->mallocFailed );
if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */
sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
onError, zName, P4_TRANSIENT,
diff --git a/src/printf.c b/src/printf.c
index 2f99208bf3..f78d3bbb17 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -427,11 +427,10 @@ void sqlite3_str_vappendf(
v = va_arg(ap,int);
}
if( v<0 ){
- if( v==SMALLEST_INT64 ){
- longvalue = ((u64)1)<<63;
- }else{
- longvalue = -v;
- }
+ testcase( v==SMALLEST_INT64 );
+ testcase( v==(-1) );
+ longvalue = ~v;
+ longvalue++;
prefix = '-';
}else{
longvalue = v;
From 7b8524168eb50520ec5f4cc5cd709be06e210818 Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 28 Aug 2020 13:10:00 +0000
Subject: [PATCH 038/169] Update Lemon documentation. Patches from sgbeal.
FossilOrigin-Name: f5dc83442bf010bc4083e083b3a1acbb9918b7e685ca676dd899a0e09df196bc
---
doc/lemon.html | 252 ++++++++++++++++++++++++-------------------------
manifest | 12 +--
manifest.uuid | 2 +-
3 files changed, 132 insertions(+), 134 deletions(-)
diff --git a/doc/lemon.html b/doc/lemon.html
index 714cbfa5b2..b1f871481d 100644
--- a/doc/lemon.html
+++ b/doc/lemon.html
@@ -27,7 +27,7 @@ parser generator.
The language parser code created by Lemon is very robust and
is well-suited for use in internet-facing applications that need to
-safely process maliciously crafted inputs.
+safely process maliciously crafted inputs.
The "lemon.exe" command-line tool itself works great when given a valid
input grammar file and almost always gives helpful
@@ -48,36 +48,36 @@ To summarize:
The main goal of Lemon is to translate a context free grammar (CFG)
for a particular language into C code that implements a parser for
that language.
-The program has two inputs:
+The program has two inputs:
- The grammar specification.
- A parser template file.
-Typically, only the grammar specification is supplied by the programmer.
+Typically, only the grammar specification is supplied by the programmer.
Lemon comes with a default parser template which works fine for most
applications. But the user is free to substitute a different parser
template if desired.
Depending on command-line options, Lemon will generate up to
-three output files.
+three output files.
- C code to implement the parser.
- A header file defining an integer ID for each terminal symbol.
- An information file that describes the states of the generated parser
automaton.
-By default, all three of these output files are generated.
+By default, all three of these output files are generated.
The header file is suppressed if the "-m" command-line option is
used and the report file is omitted when "-q" is selected.
The grammar specification file uses a ".y" suffix, by convention.
In the examples used in this document, we'll assume the name of the
grammar file is "gram.y". A typical use of Lemon would be the
-following command:
+following command:
lemon gram.y
-This command will generate three output files named "gram.c",
+This command will generate three output files named "gram.c",
"gram.h" and "gram.out".
The first is C code to implement the parser. The second
is the header file that defines numerical values for all
@@ -88,11 +88,11 @@ the states used by the parser automaton.
The behavior of Lemon can be modified using command-line options.
You can obtain a list of the available command-line options together
-with a brief explanation of what each does by typing
+with a brief explanation of what each does by typing
lemon "-?"
-As of this writing, the following command-line options are supported:
+As of this writing, the following command-line options are supported:
- -b
Show only the basis for each parser state in the report file.
@@ -144,11 +144,11 @@ complete system.
Before a program begins using a Lemon-generated parser, the program
must first create the parser.
-A new parser is created as follows:
+A new parser is created as follows:
void *pParser = ParseAlloc( malloc );
-The ParseAlloc() routine allocates and initializes a new parser and
+The ParseAlloc() routine allocates and initializes a new parser and
returns a pointer to it.
The actual data structure used to represent a parser is opaque —
its internal structure is not visible or usable by the calling routine.
@@ -158,22 +158,22 @@ The sole argument to the ParseAlloc() routine is a pointer to the
subroutine used to allocate memory. Typically this means malloc().
After a program is finished using a parser, it can reclaim all
-memory allocated by that parser by calling
+memory allocated by that parser by calling
ParseFree(pParser, free);
-The first argument is the same pointer returned by ParseAlloc(). The
+The first argument is the same pointer returned by ParseAlloc(). The
second argument is a pointer to the function used to release bulk
memory back to the system.
After a parser has been allocated using ParseAlloc(), the programmer
must supply the parser with a sequence of tokens (terminal symbols) to
be parsed. This is accomplished by calling the following function
-once for each token:
+once for each token:
Parse(pParser, hTokenID, sTokenData, pArg);
-The first argument to the Parse() routine is the pointer returned by
+The first argument to the Parse() routine is the pointer returned by
ParseAlloc().
The second argument is a small positive integer that tells the parser the
type of the next token in the data stream.
@@ -199,7 +199,7 @@ This is a convenient mechanism for passing state information down
to the action routines without having to use global variables.
A typical use of a Lemon parser might look something like the
-following:
+following:
1 ParseTree *ParseFile(const char *zFilename){
2 Tokenizer *pTokenizer;
@@ -220,7 +220,7 @@ following:
17 return sState.treeRoot;
18 }
-This example shows a user-written routine that parses a file of
+This example shows a user-written routine that parses a file of
text and returns a pointer to the parse tree.
(All error-handling code is omitted from this example to keep it
simple.)
@@ -232,7 +232,7 @@ integer variable hTokenId. The sToken variable is assumed to be
some kind of structure that contains details about each token,
such as its complete text, what line it occurs on, etc.
-This example also assumes the existence of structure of type
+
This example also assumes the existence of a structure of type
ParserState that holds state information about a particular parse.
An instance of such a structure is created on line 6 and initialized
on line 10. A pointer to this structure is passed into the Parse()
@@ -243,7 +243,7 @@ appropriate. In the example, we note that the treeRoot field of
the ParserState structure is left pointing to the root of the parse
tree.
-The core of this example as it relates to Lemon is as follows:
+
The core of this example as it relates to Lemon is as follows:
ParseFile(){
pParser = ParseAlloc( malloc );
@@ -254,7 +254,7 @@ tree.
ParseFree(pParser, free );
}
-Basically, what a program has to do to use a Lemon-generated parser
+Basically, what a program has to do to use a Lemon-generated parser
is first create the parser, then send it lots of tokens obtained by
tokenizing an input source. When the end of input is reached, the
Parse() routine should be called one last time with a token type
@@ -265,11 +265,11 @@ parser by calling ParseFree().
There is one other interface routine that should be mentioned
before we move on.
The ParseTrace() function can be used to generate debugging output
-from the parser. A prototype for this routine is as follows:
+from the parser. A prototype for this routine is as follows:
ParseTrace(FILE *stream, char *zPrefix);
-After this routine is called, a short (one-line) message is written
+After this routine is called, a short (one-line) message is written
to the designated output stream every time the parser changes states
or calls an action routine. Each such message is prefaced using
the text given by zPrefix. This debugging output can be turned off
@@ -279,7 +279,7 @@ by calling ParseTrace() again with a first argument of NULL (0).
Programmers who have previously used the yacc or bison parser
generator will notice several important differences between yacc and/or
-bison and Lemon.
+bison and Lemon.
- In yacc and bison, the parser calls the tokenizer. In Lemon,
the tokenizer calls the parser.
@@ -288,7 +288,7 @@ bison and Lemon.
- Lemon allows multiple parsers to be running simultaneously. Yacc
and bison do not.
-These differences may cause some initial confusion for programmers
+These differences may cause some initial confusion for programmers
with prior yacc and bison experience.
But after years of experience using Lemon, I firmly
believe that the Lemon way of doing things is better.
@@ -307,11 +307,11 @@ specifies additional information Lemon requires to do its job.
Most of the work in using Lemon is in writing an appropriate
grammar file.
-The grammar file for Lemon is, for the most part, free format.
+
The grammar file for Lemon is, for the most part, a free format.
It does not have sections or divisions like yacc or bison. Any
-declaration can occur at any point in the file.
-Lemon ignores whitespace (except where it is needed to separate
-tokens), and it honors the same commenting conventions as C and C++.
+declaration can occur at any point in the file. Lemon ignores
+whitespace (except where it is needed to separate tokens), and it
+honors the same commenting conventions as C and C++.
Terminals and Nonterminals
@@ -351,14 +351,13 @@ Rules can occur in any order, except that the left-hand side of the
first rule is assumed to be the start symbol for the grammar (unless
specified otherwise using the %start_symbol
directive described below.)
-A typical sequence of grammar rules might look something like this:
+A typical sequence of grammar rules might look something like this:
expr ::= expr PLUS expr.
expr ::= expr TIMES expr.
expr ::= LPAREN expr RPAREN.
expr ::= VALUE.
-
There is one non-terminal in this example, "expr", and five
terminal symbols or tokens: "PLUS", "TIMES", "LPAREN",
@@ -370,11 +369,10 @@ by the parser.
In Lemon, this action is specified by putting the C code (contained
within curly braces {...}) immediately after the
period that closes the rule.
-For example:
+For example:
expr ::= expr PLUS expr. { printf("Doing an addition...\n"); }
-
In order to be useful, grammar actions must normally be linked to
their associated grammar rules.
@@ -391,18 +389,18 @@ rule and say "$7" when you really mean "$8".
Lemon avoids the need to count grammar symbols by assigning symbolic
names to each symbol in a grammar rule and then using those symbolic
names in the action.
-In yacc or bison, one would write this:
+In yacc or bison, one would write this:
expr -> expr PLUS expr { $$ = $1 + $3; };
-But in Lemon, the same rule becomes the following:
+But in Lemon, the same rule becomes the following:
expr(A) ::= expr(B) PLUS expr(C). { A = B+C; }
-In the Lemon rule, any symbol in parentheses after a grammar rule
+In the Lemon rule, any symbol in parentheses after a grammar rule
symbol becomes a place holder for that symbol in the grammar rule.
This place holder can then be used in the associated C action to
-stand for the value of that symbol.
+stand for the value of that symbol.
The Lemon notation for linking a grammar rule with its reduce
action is superior to yacc/bison on several counts.
@@ -412,11 +410,11 @@ Secondly, if a terminal or nonterminal in a Lemon grammar rule
includes a linking symbol in parentheses but that linking symbol
is not actually used in the reduce action, then an error message
is generated.
-For example, the rule
+For example, the rule
expr(A) ::= expr(B) PLUS expr(C). { A = B; }
-will generate an error because the linking symbol "C" is used
+will generate an error because the linking symbol "C" is used
in the grammar rule but not in the reduce action.
The Lemon notation for linking grammar rules to reduce actions
@@ -424,7 +422,7 @@ also facilitates the use of destructors for reclaiming memory
allocated by the values of terminals and nonterminals on the
right-hand side of a rule.
-
+
Precedence Rules
Lemon resolves parsing ambiguities in exactly the same way as
@@ -443,50 +441,50 @@ using the
mentioned in earlier directives have a lower precedence than
terminal symbols mentioned in later directives. For example:
-
+
%left AND.
%left OR.
%nonassoc EQ NE GT GE LT LE.
%left PLUS MINUS.
%left TIMES DIVIDE MOD.
%right EXP NOT.
-
+
In the preceding sequence of directives, the AND operator is
defined to have the lowest precedence. The OR operator is one
precedence level higher. And so forth. Hence, the grammar would
-attempt to group the ambiguous expression
+attempt to group the ambiguous expression
a AND b OR c
-like this
+like this
a AND (b OR c).
-The associativity (left, right or nonassoc) is used to determine
+The associativity (left, right or nonassoc) is used to determine
the grouping when the precedence is the same. AND is left-associative
-in our example, so
+in our example, so
a AND b AND c
-is parsed like this
+is parsed like this
(a AND b) AND c.
-The EXP operator is right-associative, though, so
+The EXP operator is right-associative, though, so
a EXP b EXP c
-is parsed like this
+is parsed like this
a EXP (b EXP c).
-The nonassoc precedence is used for non-associative operators.
-So
+The nonassoc precedence is used for non-associative operators.
+So
a EQ b EQ c
-is an error.
+is an error.
The precedence of non-terminals is transferred to rules as follows:
The precedence of a grammar rule is equal to the precedence of the
@@ -497,9 +495,9 @@ you can specify an alternative precedence symbol by putting the
symbol in square braces after the period at the end of the rule and
before any C-code. For example:
-
+
expr = MINUS expr. [NOT]
-
+
This rule has a precedence equal to that of the NOT symbol, not the
MINUS symbol as would have been the case by default.
@@ -508,7 +506,7 @@ MINUS symbol as would have been the case by default.
symbols and individual
grammar rules, we can now explain precisely how parsing conflicts
are resolved in Lemon. Shift-reduce conflicts are resolved
-as follows:
+as follows:
- If either the token to be shifted or the rule to be reduced
lacks precedence information, then resolve in favor of the
@@ -528,7 +526,7 @@ as follows:
- Otherwise, resolve the conflict by doing the shift, and
report a parsing conflict.
-Reduce-reduce conflicts are resolved this way:
+Reduce-reduce conflicts are resolved this way:
- If either reduce rule
lacks precedence information, then resolve in favor of the
@@ -553,7 +551,7 @@ grammar rules. It doesn't matter. The relative order of
directives used to assign precedence to terminals is important, but
other than that, the order of directives in Lemon is arbitrary.
-
Lemon supports the following special directives:
+
Lemon supports the following special directives:
-Each of these directives will be described separately in the
+Each of these directives will be described separately in the
following sections:
-
+
The %code directive
The %code directive is used to specify additional C code that
@@ -599,13 +597,13 @@ the %include directive except that
a tokenizer or even the "main()" function
as part of the output file.
-
+
The %default_destructor directive
The %default_destructor directive specifies a destructor to
use for non-terminals that do not have their own destructor
specified by a separate %destructor directive. See the documentation
-on the %destructor directive below for
+on the %destructor directive below for
additional information.
In some grammars, many different non-terminal symbols have the
@@ -613,14 +611,14 @@ same data type and hence the same destructor. This directive is
a convenient way to specify the same destructor for all those
non-terminals using a single statement.
-
+
The %default_type directive
The %default_type directive specifies the data type of non-terminal
symbols that do not have their own data type defined using a separate
%type directive.
-
+
The %destructor directive
The %destructor directive is used to specify a destructor for
@@ -630,24 +628,24 @@ directive which is used to specify a destructor for terminal symbols.)
A non-terminal's destructor is called to dispose of the
non-terminal's value whenever the non-terminal is popped from
-the stack. This includes all of the following circumstances:
+the stack. This includes all of the following circumstances:
- When a rule reduces and the value of a non-terminal on
the right-hand side is not linked to C code.
- When the stack is popped during error processing.
- When the ParseFree() function runs.
-The destructor can do whatever it wants with the value of
+The destructor can do whatever it wants with the value of
the non-terminal, but its design is to deallocate memory
or other resources held by that non-terminal.
-Consider an example:
+
Consider an example:
%type nt {void*}
%destructor nt { free($$); }
nt(A) ::= ID NUM. { A = malloc( 100 ); }
-This example is a bit contrived, but it serves to illustrate how
+This example is a bit contrived, but it serves to illustrate how
destructors work. The example shows a non-terminal named
"nt" that holds values of type "void*". When the rule for
an "nt" reduces, it sets the value of the non-terminal to
@@ -670,18 +668,18 @@ the destructor is not called in this circumstance.
allocated objects when they go out of scope.
To do the same using yacc or bison is much more difficult.
-
+
The %extra_argument directive
-The %extra_argument directive instructs Lemon to add a 4th parameter
+The %extra_argument directive instructs Lemon to add a 4th parameter
to the parameter list of the Parse() function it generates. Lemon
doesn't do anything itself with this extra argument, but it does
make the argument available to C-code action routines, destructors,
and so forth. For example, if the grammar file contains:
-
+
%extra_argument { MyStruct *pAbc }
-
+
Then the Parse() function generated will have an 4th parameter
of type "MyStruct*" and all action routines will have access to
@@ -690,29 +688,29 @@ in the most recent call to Parse().
The %extra_context directive works the same except that it
is passed in on the ParseAlloc() or ParseInit() routines instead of
-on Parse().
+on Parse().
-
+
The %extra_context directive
-The %extra_context directive instructs Lemon to add a 2nd parameter
-to the parameter list of the ParseAlloc() and ParseInif() functions. Lemon
+The %extra_context directive instructs Lemon to add a 2nd parameter
+to the parameter list of the ParseAlloc() and ParseInit() functions. Lemon
doesn't do anything itself with these extra argument, but it does
store the value make it available to C-code action routines, destructors,
and so forth. For example, if the grammar file contains:
-
+
%extra_context { MyStruct *pAbc }
-
+
Then the ParseAlloc() and ParseInit() functions will have an 2nd parameter
of type "MyStruct*" and all action routines will have access to
a variable named "pAbc" that is the value of that 2nd parameter.
The %extra_argument directive works the same except that it
-is passed in on the Parse() routine instead of on ParseAlloc()/ParseInit().
+is passed in on the Parse() routine instead of on ParseAlloc()/ParseInit().
-
+
The %fallback directive
The %fallback directive specifies an alternative meaning for one
@@ -729,7 +727,7 @@ obscure language keyword for an identifier. The %fallback directive
provides a mechanism to tell the parser: "If you are unable to parse
this keyword, try treating it as an identifier instead."
-The syntax of %fallback is as follows:
+
The syntax of %fallback is as follows:
%fallback ID TOKEN... .
@@ -742,7 +740,7 @@ token to which all the other tokens fall back to. The second and subsequent
arguments are tokens which fall back to the token identified by the first
argument.
-
+
The %if directive and its friends
The %if, %ifdef, %ifndef, %else,
@@ -773,7 +771,7 @@ its corresponding %endif.
intended to be a single preprocessor symbol name, not a general expression.
Use the "%if" directive for general expressions.
-
+
The %include directive
The %include directive specifies C code that is included at the
@@ -787,9 +785,9 @@ generated parser, in the same order as it appeared in the grammar.
preprocessor statements at the beginning of the generated parser.
For example:
-
+
%include {#include <unistd.h>}
-
+
This might be needed, for example, if some of the C actions in the
grammar call functions that are prototyped in unistd.h.
@@ -797,7 +795,7 @@ grammar call functions that are prototyped in unistd.h.
Use the %code directive to add code to
the end of the generated parser.
-
+
The %left directive
The %left directive is used (along with the
@@ -809,14 +807,14 @@ a %left directive but before the next period (".") is
given the same left-associative precedence value. Subsequent
%left directives have higher precedence. For example:
-
+
%left AND.
%left OR.
%nonassoc EQ NE GT GE LT LE.
%left PLUS MINUS.
%left TIMES DIVIDE MOD.
%right EXP NOT.
-
+
Note the period that terminates each %left,
%right or %nonassoc
@@ -827,29 +825,29 @@ a large amount of stack space if you make heavy use or right-associative
operators. For this reason, it is recommended that you use %left
rather than %right whenever possible.
-
+
The %name directive
By default, the functions generated by Lemon all begin with the
five-character string "Parse". You can change this string to something
different using the %name directive. For instance:
-
+
%name Abcde
-
+
Putting this directive in the grammar file will cause Lemon to generate
-functions named
+functions named
- AbcdeAlloc(),
- AbcdeFree(),
- AbcdeTrace(), and
- Abcde().
-The %name directive allows you to generate two or more different
+The %name directive allows you to generate two or more different
parsers and link them all into the same executable.
-
+
The %nonassoc directive
This directive is used to assign non-associative precedence to
@@ -858,7 +856,7 @@ one or more terminal symbols. See the section on
or on the %left directive
for additional information.
-
+
The %parse_accept directive
The %parse_accept directive specifies a block of C code that is
@@ -868,13 +866,13 @@ without error.
For example:
-
+
%parse_accept {
printf("parsing complete!\n");
}
-
+
-
+
The %parse_failure directive
The %parse_failure directive specifies a block of C code that
@@ -883,13 +881,13 @@ executed until the parser has tried and failed to resolve an input
error using is usual error recovery strategy. The routine is
only invoked when parsing is unable to continue.
-
+
%parse_failure {
fprintf(stderr,"Giving up. Parser is hopelessly lost...\n");
}
-
+
-
+
The %right directive
This directive is used to assign right-associative precedence to
@@ -897,7 +895,7 @@ one or more terminal symbols. See the section on
precedence rules
or on the %left directive for additional information.
-
+
The %stack_overflow directive
The %stack_overflow directive specifies a block of C code that
@@ -905,28 +903,28 @@ is executed if the parser's internal stack ever overflows. Typically
this just prints an error message. After a stack overflow, the parser
will be unable to continue and must be reset.
-
+
%stack_overflow {
fprintf(stderr,"Giving up. Parser stack overflow\n");
}
-
+
You can help prevent parser stack overflows by avoiding the use
of right recursion and right-precedence operators in your grammar.
Use left recursion and and left-precedence operators instead to
encourage rules to reduce sooner and keep the stack size down.
-For example, do rules like this:
+For example, do rules like this:
list ::= list element. // left-recursion. Good!
list ::= .
-Not like this:
+Not like this:
list ::= element list. // right-recursion. Bad!
list ::= .
-
+
-
+
The %stack_size directive
If stack overflow is a problem and you can't resolve the trouble
@@ -935,11 +933,11 @@ of the parser's stack using this directive. Put an positive integer
after the %stack_size directive and Lemon will generate a parse
with a stack of the requested size. The default value is 100.
-
+
%stack_size 2000
-
+
-
+
The %start_symbol directive
By default, the start symbol for the grammar that Lemon generates
@@ -947,22 +945,22 @@ is the first non-terminal that appears in the grammar file. But you
can choose a different start symbol using the
%start_symbol directive.
-
+
%start_symbol prog
-
+
-
+
The %syntax_error directive
See Error Processing.
-
+
The %token_class directive
Undocumented. Appears to be related to the MULTITERMINAL concept.
Implementation.
-
+
The %token_destructor directive
The %destructor directive assigns a destructor to a non-terminal
@@ -971,14 +969,14 @@ symbol. (See the description of the
The %token_destructor directive does the same thing
for all terminal symbols.
-Unlike non-terminal symbols which may each have a different data type
+
Unlike non-terminal symbols, which may each have a different data type
for their values, terminals all use the same data type (defined by
the %token_type directive)
and so they use a common destructor.
Other than that, the token destructor works just like the non-terminal
destructors.
-
+
The %token_prefix directive
Lemon generates #defines that assign small integer constants
@@ -986,26 +984,26 @@ to each terminal symbol in the grammar. If desired, Lemon will
add a prefix specified by this directive
to each of the #defines it generates.
-So if the default output of Lemon looked like this:
+
So if the default output of Lemon looked like this:
#define AND 1
#define MINUS 2
#define OR 3
#define PLUS 4
-You can insert a statement into the grammar like this:
+You can insert a statement into the grammar like this:
%token_prefix TOKEN_
-to cause Lemon to produce these symbols instead:
+to cause Lemon to produce these symbols instead:
#define TOKEN_AND 1
#define TOKEN_MINUS 2
#define TOKEN_OR 3
#define TOKEN_PLUS 4
-
+
-
+
The %token_type and %type directives
These directives are used to specify the data types for values
@@ -1016,9 +1014,9 @@ to the Parse() function generated by Lemon. Typically, you will
make the value of a terminal symbol be a pointer to some kind of
token structure. Like this:
-
+
%token_type {Token*}
-
+
If the data type of terminals is not specified, the default value
is "void*".
@@ -1028,9 +1026,9 @@ the data type of a non-terminal is a pointer to the root of a parse tree
structure that contains all information about that non-terminal.
For example:
-
+
%type expr {Expr*}
-
+
Each entry on the parser's stack is actually a union containing
instances of all data types for every non-terminal and terminal symbol.
@@ -1042,7 +1040,7 @@ non-terminal whose data type requires 1K of storage, then your 100
entry parser stack will require 100K of heap space. If you are willing
and able to pay that price, fine. You just need to know.
-
+
The %wildcard directive
The %wildcard directive is followed by a single token name and a
@@ -1053,7 +1051,7 @@ match any input token.
the wildcard token and some other token, the other token is always used.
The wildcard token is only matched if there are no alternatives.
-
+
Error Processing
After extensive experimentation over several years, it has been
diff --git a/manifest b/manifest
index 9d7a1f4ca0..da6e96e9fd 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\scouple\sof\sunreachable\sbranches.
-D 2020-08-28T12:58:21.030
+C Update\sLemon\sdocumentation.\s\sPatches\sfrom\ssgbeal.
+D 2020-08-28T13:10:00.216
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -38,7 +38,7 @@ F configure 63af83d31b9fdf304f2dbb1e1638530d4ceff31702d1e19550d1fbf3bdf9471e x
F configure.ac 40d01e89cb325c28b33f5957e61fede0bd17da2b5e37d9b223a90c8a318e88d4
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
-F doc/lemon.html 1edc0f916e771212792d4d077aedc05168bf13fd65d64d41b2c13e46ac0063a8
+F doc/lemon.html 5155bf346e59385ac8d14da0c1e895d8dbc5d225a7d93d3f8249cbfb3c938f55
F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
F doc/trusted-schema.md 33625008620e879c7bcfbbfa079587612c434fa094d338b08242288d358c3e8a
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
@@ -1879,7 +1879,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 1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
-R 226559a22dbe15c2cb43501373224222
+P f2d26f2b11317abd4f993faa1a4df7afcd1a2d4e448ecc69ca05e9ebf102cd62
+R 218381265e6cb716367061639a662304
U drh
-Z 999aada41f64ce3323554005b08290d8
+Z cdee44e4fe786c40d615ee283889a90d
diff --git a/manifest.uuid b/manifest.uuid
index f21521198d..2c9b5af71f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-f2d26f2b11317abd4f993faa1a4df7afcd1a2d4e448ecc69ca05e9ebf102cd62
\ No newline at end of file
+f5dc83442bf010bc4083e083b3a1acbb9918b7e685ca676dd899a0e09df196bc
\ No newline at end of file
From 72c38d87bf7b77849214136d7b6329e003ff5c45 Mon Sep 17 00:00:00 2001
From: mistachkin
Date: Fri, 28 Aug 2020 18:47:39 +0000
Subject: [PATCH 039/169] Add the miscellaneous 'series' extension to the
shell.
FossilOrigin-Name: fc0856dccfab273d50457052fa3c6da768d0eb2504ad04d9540da4e3222fc829
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/shell.c.in | 2 ++
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index da6e96e9fd..8323125ab8 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sLemon\sdocumentation.\s\sPatches\sfrom\ssgbeal.
-D 2020-08-28T13:10:00.216
+C Add\sthe\smiscellaneous\s'series'\sextension\sto\sthe\sshell.
+D 2020-08-28T18:47:39.103
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -536,7 +536,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
-F src/shell.c.in ee40209106b1f12e1ae803deb427f7ab153bd7ab6fed16ed3ba8b6a6d1fa74d5
+F src/shell.c.in 14385d8c121600bd9092824d5cf7646eb717137648bc342077987c49e16de216
F src/sqlite.h.in b91e4a5b9b25eb95260be0bf9716d2bdba0da06b72eb439f41592b226f58881d
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1879,7 +1879,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 f2d26f2b11317abd4f993faa1a4df7afcd1a2d4e448ecc69ca05e9ebf102cd62
-R 218381265e6cb716367061639a662304
-U drh
-Z cdee44e4fe786c40d615ee283889a90d
+P f5dc83442bf010bc4083e083b3a1acbb9918b7e685ca676dd899a0e09df196bc
+R 0da8852a3ea0f7fec760bfd24db5abb1
+U mistachkin
+Z 38cb6ddc65539c9d256db3cbd2220668
diff --git a/manifest.uuid b/manifest.uuid
index 2c9b5af71f..65f7dca151 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-f5dc83442bf010bc4083e083b3a1acbb9918b7e685ca676dd899a0e09df196bc
\ No newline at end of file
+fc0856dccfab273d50457052fa3c6da768d0eb2504ad04d9540da4e3222fc829
\ No newline at end of file
diff --git a/src/shell.c.in b/src/shell.c.in
index aef7e85d37..addd9779b2 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -1028,6 +1028,7 @@ INCLUDE ../ext/misc/memtrace.c
INCLUDE ../ext/misc/uint.c
INCLUDE ../ext/misc/decimal.c
INCLUDE ../ext/misc/ieee754.c
+INCLUDE ../ext/misc/series.c
#ifdef SQLITE_HAVE_ZLIB
INCLUDE ../ext/misc/zipfile.c
INCLUDE ../ext/misc/sqlar.c
@@ -4590,6 +4591,7 @@ static void open_db(ShellState *p, int openFlags){
sqlite3_uint_init(p->db, 0, 0);
sqlite3_decimal_init(p->db, 0, 0);
sqlite3_ieee_init(p->db, 0, 0);
+ sqlite3_series_init(p->db, 0, 0);
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
sqlite3_dbdata_init(p->db, 0, 0);
#endif
From 8337da6678bc2f83c0ba84aec89c751cdeadf1e5 Mon Sep 17 00:00:00 2001
From: dan
Date: Fri, 28 Aug 2020 19:27:15 +0000
Subject: [PATCH 040/169] Modify the unixShmLock() function to avoid iterating
through the (possibly large) set of connections to the same database file.
FossilOrigin-Name: e0faddf0dfc3a40b6b94408296dd781dd0264ecc9f2129ce4405438433fb00e0
---
manifest | 15 ++++---
manifest.uuid | 2 +-
src/os_unix.c | 111 +++++++++++++++++++++++++++++++-------------------
3 files changed, 80 insertions(+), 48 deletions(-)
diff --git a/manifest b/manifest
index abe12971e2..fd5ff92eb8 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sfts5\stest\sto\sconfirm\sthat\sfor\sa\stable\swith\scolumns\sa,\sb,\sc\sand\sd,\s"{a\sb}"\sand\s"-{c\sd}"\sare\shandled\ssimilarly.
-D 2020-08-28T11:19:49.438
+C Modify\sthe\sunixShmLock()\sfunction\sto\savoid\siterating\sthrough\sthe\s(possibly\slarge)\sset\sof\sconnections\sto\sthe\ssame\sdatabase\sfile.
+D 2020-08-28T19:27:15.533
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -519,7 +519,7 @@ F src/os.c 80e4cf3e5da06be03ca641661e331ce60eeeeabf0d7354dbb1c0e166d0eedbbe
F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c 13553fb5ffbe8c0e60f5d7f553667560b7dece9e31cdfcf8b57b33092a11f226
+F src/os_unix.c 0120726d5ceb10f0a932dbcca3cd2c4c0f110c7f8eab3a788b34cc7accdad6cc
F src/os_win.c a2149ff0a85c1c3f9cc102a46c673ce87e992396ba3411bfb53db66813b32f1d
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
@@ -1879,7 +1879,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 3f7bbb840de0a9b1ca89288805cb151aea6fcb82efda9ba39f51abf1b17c070b
-R 68183e6ade81d2ecd369f241c0d2a0e4
+P 1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
+R 2ca214335aa99f522db85aff8974dca1
+T *branch * unixshmlock-opt
+T *sym-unixshmlock-opt *
+T -sym-trunk *
U dan
-Z 8ead3559fc701c9e301c92555bb4b25a
+Z 2322c300ab82408a3c9b557087654b84
diff --git a/manifest.uuid b/manifest.uuid
index 97978cf340..93095b8459 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
\ No newline at end of file
+e0faddf0dfc3a40b6b94408296dd781dd0264ecc9f2129ce4405438433fb00e0
\ No newline at end of file
diff --git a/src/os_unix.c b/src/os_unix.c
index c9b59f229a..0eb2d5b000 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4255,6 +4255,7 @@ struct unixShmNode {
char **apRegion; /* Array of mapped shared-memory regions */
int nRef; /* Number of unixShm objects pointing to this */
unixShm *pFirst; /* All unixShm objects pointing to this */
+ int aLock[SQLITE_SHM_NLOCK]; /* # shared locks on slot, -1==excl lock */
#ifdef SQLITE_DEBUG
u8 exclMask; /* Mask of exclusive locks held */
u8 sharedMask; /* Mask of shared locks held */
@@ -4795,6 +4796,38 @@ shmpage_out:
return rc;
}
+/*
+** Check that the pShmNode->aLock[] array comports with the locking bitmasks
+** held by each client. Return true if it does, or false otherwise. This
+** is to be used in an assert(). e.g.
+**
+** assert( assertLockingArrayOk(pShmNode) );
+*/
+#ifdef SQLITE_DEBUG
+static int assertLockingArrayOk(unixShmNode *pShmNode){
+ unixShm *pX;
+ int aLock[SQLITE_SHM_NLOCK];
+ assert( sqlite3_mutex_held(pShmNode->pShmMutex) );
+
+ memset(aLock, 0, sizeof(aLock));
+ for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
+ int i;
+ for(i=0; iexclMask & (1<sharedMask & (1<=0 );
+ aLock[i]++;
+ }
+ }
+ }
+
+ assert( 0==memcmp(pShmNode->aLock, aLock, sizeof(aLock)) );
+ return (memcmp(pShmNode->aLock, aLock, sizeof(aLock))==0);
+}
+#endif
+
/*
** Change the lock state for a shared-memory segment.
**
@@ -4811,10 +4844,10 @@ static int unixShmLock(
){
unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */
unixShm *p = pDbFd->pShm; /* The shared memory being locked */
- unixShm *pX; /* For looping over all siblings */
unixShmNode *pShmNode = p->pShmNode; /* The underlying file iNode */
int rc = SQLITE_OK; /* Result code */
u16 mask; /* Mask of locks to take or release */
+ int *aLock = pShmNode->aLock;
assert( pShmNode==pDbFd->pInode->pShmNode );
assert( pShmNode->pInode==pDbFd->pInode );
@@ -4853,21 +4886,25 @@ static int unixShmLock(
mask = (1<<(ofst+n)) - (1<1 || mask==(1<pShmMutex);
+ assert( assertLockingArrayOk(pShmNode) );
if( flags & SQLITE_SHM_UNLOCK ){
- u16 allMask = 0; /* Mask of locks held by siblings */
+ int ii;
+ int bUnlock = 1;
- /* See if any siblings hold this same lock */
- for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
- if( pX==p ) continue;
- assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 );
- allMask |= pX->sharedMask;
+ for(ii=ofst; ii((p->sharedMask & (1<sharedMask & (1<1 );
+ aLock[ofst]--;
}
/* Undo the local locks */
@@ -4876,55 +4913,47 @@ static int unixShmLock(
p->sharedMask &= ~mask;
}
}else if( flags & SQLITE_SHM_SHARED ){
- u16 allShared = 0; /* Union of locks held by connections other than "p" */
-
- /* Find out which shared locks are already held by sibling connections.
- ** If any sibling already holds an exclusive lock, go ahead and return
- ** SQLITE_BUSY.
- */
- for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
- if( (pX->exclMask & mask)!=0 ){
+ assert( n==1 );
+ assert( (p->exclMask & (1<sharedMask & mask)==0 ){
+ if( aLock[ofst]<0 ){
rc = SQLITE_BUSY;
- break;
- }
- allShared |= pX->sharedMask;
- }
-
- /* Get shared locks at the system level, if necessary */
- if( rc==SQLITE_OK ){
- if( (allShared & mask)==0 ){
+ }else if( aLock[ofst]==0 ){
rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n);
- }else{
- rc = SQLITE_OK;
}
- }
- /* Get the local shared locks */
- if( rc==SQLITE_OK ){
- p->sharedMask |= mask;
+ /* Get the local shared locks */
+ if( rc==SQLITE_OK ){
+ p->sharedMask |= mask;
+ aLock[ofst]++;
+ }
}
}else{
/* Make sure no sibling connections hold locks that will block this
- ** lock. If any do, return SQLITE_BUSY right away.
- */
- for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
- if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){
+ ** lock. If any do, return SQLITE_BUSY right away. */
+ int ii;
+ for(ii=ofst; iisharedMask & mask)==0 );
+ if( (p->exclMask & (1<sharedMask & mask)==0 );
p->exclMask |= mask;
+ for(ii=ofst; iipShmMutex);
OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
p->id, osGetpid(0), p->sharedMask, p->exclMask));
From 6acdee676551f5fc2fc5ab89bed8c379769eafa9 Mon Sep 17 00:00:00 2001
From: dan
Date: Fri, 28 Aug 2020 20:01:06 +0000
Subject: [PATCH 041/169] Fix handling of an xShmLock(SHARED, UNLOCK) call when
the caller does not hold any lock on the specified slot, but another
connection in the same process holds an EXCLUSIVE.
FossilOrigin-Name: 3eb365027b885e1f61965efd53a3643b6ff441ae01e79038a091314516a50dd4
---
manifest | 15 ++++++---------
manifest.uuid | 2 +-
src/os_unix.c | 40 +++++++++++++++++++++-------------------
3 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/manifest b/manifest
index fd5ff92eb8..5d3cdf5b16 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Modify\sthe\sunixShmLock()\sfunction\sto\savoid\siterating\sthrough\sthe\s(possibly\slarge)\sset\sof\sconnections\sto\sthe\ssame\sdatabase\sfile.
-D 2020-08-28T19:27:15.533
+C Fix\shandling\sof\san\sxShmLock(SHARED,\sUNLOCK)\scall\swhen\sthe\scaller\sdoes\snot\shold\sany\slock\son\sthe\sspecified\sslot,\sbut\sanother\sconnection\sin\sthe\ssame\sprocess\sholds\san\sEXCLUSIVE.
+D 2020-08-28T20:01:06.517
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -519,7 +519,7 @@ F src/os.c 80e4cf3e5da06be03ca641661e331ce60eeeeabf0d7354dbb1c0e166d0eedbbe
F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c 0120726d5ceb10f0a932dbcca3cd2c4c0f110c7f8eab3a788b34cc7accdad6cc
+F src/os_unix.c d707ed2867a2fb32101469327acf3274165d9935e9ab9e27bdab0c1a7d661be7
F src/os_win.c a2149ff0a85c1c3f9cc102a46c673ce87e992396ba3411bfb53db66813b32f1d
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
@@ -1879,10 +1879,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 1a04920998368e56276fd0b100be8343609c6ff8a731cf8e26a0490f9c6dabdf
-R 2ca214335aa99f522db85aff8974dca1
-T *branch * unixshmlock-opt
-T *sym-unixshmlock-opt *
-T -sym-trunk *
+P e0faddf0dfc3a40b6b94408296dd781dd0264ecc9f2129ce4405438433fb00e0
+R e6bcf42bbee53ae5585d2ea1ed2212fa
U dan
-Z 2322c300ab82408a3c9b557087654b84
+Z 13cfa1981b90fb57cb3c9a6bb39ef17d
diff --git a/manifest.uuid b/manifest.uuid
index 93095b8459..a7a42b45e0 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-e0faddf0dfc3a40b6b94408296dd781dd0264ecc9f2129ce4405438433fb00e0
\ No newline at end of file
+3eb365027b885e1f61965efd53a3643b6ff441ae01e79038a091314516a50dd4
\ No newline at end of file
diff --git a/src/os_unix.c b/src/os_unix.c
index 0eb2d5b000..5419a042a6 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4888,30 +4888,32 @@ static int unixShmLock(
sqlite3_mutex_enter(pShmNode->pShmMutex);
assert( assertLockingArrayOk(pShmNode) );
if( flags & SQLITE_SHM_UNLOCK ){
- int ii;
- int bUnlock = 1;
+ if( (p->exclMask|p->sharedMask) & mask ){
+ int ii;
+ int bUnlock = 1;
- for(ii=ofst; ii((p->sharedMask & (1<((p->sharedMask & (1<sharedMask & (1<1 );
+ aLock[ofst]--;
+ }
+
+ /* Undo the local locks */
if( rc==SQLITE_OK ){
- memset(&aLock[ofst], 0, sizeof(int)*n);
- }
- }else if( p->sharedMask & (1<1 );
- aLock[ofst]--;
+ p->exclMask &= ~mask;
+ p->sharedMask &= ~mask;
+ }
}
-
- /* Undo the local locks */
- if( rc==SQLITE_OK ){
- p->exclMask &= ~mask;
- p->sharedMask &= ~mask;
- }
}else if( flags & SQLITE_SHM_SHARED ){
assert( n==1 );
assert( (p->exclMask & (1<
Date: Sat, 29 Aug 2020 19:00:19 +0000
Subject: [PATCH 042/169] Fix a sanitizer warning in zipfile.c.
FossilOrigin-Name: ded1a75b3cf39834d38a385f38ae969b296f6c9409856b7eea08645e861b1ac2
---
ext/misc/zipfile.c | 16 +++++++++-------
manifest | 13 ++++++-------
manifest.uuid | 2 +-
3 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/ext/misc/zipfile.c b/ext/misc/zipfile.c
index a35a26f4d8..f9fbcfc0bd 100644
--- a/ext/misc/zipfile.c
+++ b/ext/misc/zipfile.c
@@ -523,14 +523,16 @@ static int zipfileAppendData(
const u8 *aWrite,
int nWrite
){
- size_t n;
- fseek(pTab->pWriteFd, (long)pTab->szCurrent, SEEK_SET);
- n = fwrite(aWrite, 1, nWrite, pTab->pWriteFd);
- if( (int)n!=nWrite ){
- pTab->base.zErrMsg = sqlite3_mprintf("error in fwrite()");
- return SQLITE_ERROR;
+ if( nWrite>0 ){
+ size_t n = nWrite;
+ fseek(pTab->pWriteFd, (long)pTab->szCurrent, SEEK_SET);
+ n = fwrite(aWrite, 1, nWrite, pTab->pWriteFd);
+ if( (int)n!=nWrite ){
+ pTab->base.zErrMsg = sqlite3_mprintf("error in fwrite()");
+ return SQLITE_ERROR;
+ }
+ pTab->szCurrent += nWrite;
}
- pTab->szCurrent += nWrite;
return SQLITE_OK;
}
diff --git a/manifest b/manifest
index c82cf36094..529ced1cf4 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improve\sperformance\sof\swal-mode\slocking\son\sunix\sin\scases\swhere\sthere\sare\shundreds\sof\sconnections\sto\sa\ssingle\sdatabase\swithin\sthe\ssame\sprocess.
-D 2020-08-29T15:15:07.650
+C Fix\sa\ssanitizer\swarning\sin\szipfile.c.
+D 2020-08-29T19:00:19.686
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -332,7 +332,7 @@ F ext/misc/vfsstat.c 389ea13983d3af926504c314f06a83cc858d5adc24b40af74aaed1fece0
F ext/misc/vtablog.c 5538acd0c8ddaae372331bee11608d76973436b77d6a91e8635cfc9432fba5ae
F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
F ext/misc/wholenumber.c 520f34c3099e5b7d546f13708607dc2fa173c46b68952eecf0d19cd675fec85e
-F ext/misc/zipfile.c d1be54ea83ac9ad71b8b6ffc4b60db8946ce2ceacdf6bff063fcd9489f41bb49
+F ext/misc/zipfile.c e35e035bc2765b1ccdcb15f9815c2112843fcbc8f36aa071f0e5935df7072228
F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64
F ext/rbu/rbu.c 8681f6157db6adc82c34af24b14ea8a3be0146ad2a3b6c1d5da6cb8a5796c8ce
F ext/rbu/rbu1.test 221d9c18a5e600ac9ac6b1810d99d9f99163a7909ba61597876ab6e4d4beb3d6
@@ -1879,8 +1879,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 fc0856dccfab273d50457052fa3c6da768d0eb2504ad04d9540da4e3222fc829 3eb365027b885e1f61965efd53a3643b6ff441ae01e79038a091314516a50dd4
-R e2ba8a5583c80bb95657ae8ebc8ad469
-T +closed 3eb365027b885e1f61965efd53a3643b6ff441ae01e79038a091314516a50dd4
+P a1c19eea8f141b89a0921da0724096feb21a772ef6654f164e2c36ebf9f7871e
+R 013976b1ab715f8b9b4b654d4debfb7e
U dan
-Z 6b5d0c223b51bcc2c5b4ad0cc8397b1a
+Z f2b0589b50a87bedaf2e843585ad4346
diff --git a/manifest.uuid b/manifest.uuid
index 5ee35afa3f..ac62618068 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-a1c19eea8f141b89a0921da0724096feb21a772ef6654f164e2c36ebf9f7871e
\ No newline at end of file
+ded1a75b3cf39834d38a385f38ae969b296f6c9409856b7eea08645e861b1ac2
\ No newline at end of file
From c51ceeb049fd108b71da3ce916cf7c35191311a0 Mon Sep 17 00:00:00 2001
From: drh
Date: Mon, 31 Aug 2020 12:29:03 +0000
Subject: [PATCH 043/169] Fix the documentation for the OP_IdxGT family of
opcodes to show that the P5 operand is not used.
FossilOrigin-Name: 62f7d2a61259f296ffdcb3b3ee1a13925c4563ac8ed669f8a8a63fc7bc3a0a37
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/vdbe.c | 9 ++++-----
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/manifest b/manifest
index 529ced1cf4..3960de1cb1 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\ssanitizer\swarning\sin\szipfile.c.
-D 2020-08-29T19:00:19.686
+C Fix\sthe\sdocumentation\sfor\sthe\sOP_IdxGT\sfamily\sof\sopcodes\sto\sshow\sthat\sthe\nP5\soperand\sis\snot\sused.
+D 2020-08-31T12:29:03.480
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c e88c94a53f571b6cdc67a8dbdc2ac49ddb3c5b2435aad72d68612b2464728faa
+F src/vdbe.c c5da1456c9de0993055be9c10ebc5f5eb2be75d28cb01c8abc2f083923835a2d
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 762abffb7709f19c2cb74af1bba73a900f762e64f80d69c31c9ae89ed1066b60
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -1879,7 +1879,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 a1c19eea8f141b89a0921da0724096feb21a772ef6654f164e2c36ebf9f7871e
-R 013976b1ab715f8b9b4b654d4debfb7e
-U dan
-Z f2b0589b50a87bedaf2e843585ad4346
+P ded1a75b3cf39834d38a385f38ae969b296f6c9409856b7eea08645e861b1ac2
+R d9747280ab6c456500686b04f563aa50
+U drh
+Z 96026921b32a7e290f8ba5e4e39f8431
diff --git a/manifest.uuid b/manifest.uuid
index ac62618068..417012c05c 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-ded1a75b3cf39834d38a385f38ae969b296f6c9409856b7eea08645e861b1ac2
\ No newline at end of file
+62f7d2a61259f296ffdcb3b3ee1a13925c4563ac8ed669f8a8a63fc7bc3a0a37
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index 6fc139b5dc..bc5addabab 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -5821,7 +5821,7 @@ case OP_FinishSeek: {
break;
}
-/* Opcode: IdxGE P1 P2 P3 P4 P5
+/* Opcode: IdxGE P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** The P4 register values beginning with P3 form an unpacked index
@@ -5832,7 +5832,7 @@ case OP_FinishSeek: {
** If the P1 index entry is greater than or equal to the key value
** then jump to P2. Otherwise fall through to the next instruction.
*/
-/* Opcode: IdxGT P1 P2 P3 P4 P5
+/* Opcode: IdxGT P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** The P4 register values beginning with P3 form an unpacked index
@@ -5843,7 +5843,7 @@ case OP_FinishSeek: {
** If the P1 index entry is greater than the key value
** then jump to P2. Otherwise fall through to the next instruction.
*/
-/* Opcode: IdxLT P1 P2 P3 P4 P5
+/* Opcode: IdxLT P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** The P4 register values beginning with P3 form an unpacked index
@@ -5854,7 +5854,7 @@ case OP_FinishSeek: {
** If the P1 index entry is less than the key value then jump to P2.
** Otherwise fall through to the next instruction.
*/
-/* Opcode: IdxLE P1 P2 P3 P4 P5
+/* Opcode: IdxLE P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** The P4 register values beginning with P3 form an unpacked index
@@ -5880,7 +5880,6 @@ case OP_IdxGE: { /* jump */
assert( pC->eCurType==CURTYPE_BTREE );
assert( pC->uc.pCursor!=0);
assert( pC->deferredMoveto==0 );
- assert( pOp->p5==0 || pOp->p5==1 );
assert( pOp->p4type==P4_INT32 );
r.pKeyInfo = pC->pKeyInfo;
r.nField = (u16)pOp->p4.i;
From 37ccfcfeb99181026f6beb35dfb0fe043130773b Mon Sep 17 00:00:00 2001
From: drh
Date: Mon, 31 Aug 2020 18:49:04 +0000
Subject: [PATCH 044/169] New test-control that returns the number of calls to
sqlite3BtreeMovetoUnpacked() on the main database and then resets the
counter. This only works for SQLITE_DEBUG builds.
FossilOrigin-Name: dca5b91926431768babac28a6faf7674a5014db95caba727995b470e92b3182a
---
manifest | 22 +++++++++++-----------
manifest.uuid | 2 +-
src/btree.c | 15 +++++++++++++++
src/btree.h | 6 ++++++
src/btreeInt.h | 3 +++
src/main.c | 18 ++++++++++++++++++
src/shell.c.in | 10 +++++++++-
src/sqlite.h.in | 1 +
8 files changed, 64 insertions(+), 13 deletions(-)
diff --git a/manifest b/manifest
index 3960de1cb1..109f2f8d59 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\sdocumentation\sfor\sthe\sOP_IdxGT\sfamily\sof\sopcodes\sto\sshow\sthat\sthe\nP5\soperand\sis\snot\sused.
-D 2020-08-31T12:29:03.480
+C New\stest-control\sthat\sreturns\sthe\snumber\sof\scalls\sto\nsqlite3BtreeMovetoUnpacked()\son\sthe\smain\sdatabase\sand\sthen\sresets\sthe\ncounter.\s\sThis\sonly\sworks\sfor\sSQLITE_DEBUG\sbuilds.
+D 2020-08-31T18:49:04.199
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -476,9 +476,9 @@ F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06
F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
-F src/btree.c 634381c86f363dfd470c9dbe64c07363e746cb9917573f67381c861b1d264d8d
-F src/btree.h c299ab8b279230de1ef457f298ade9848c7339de6ef88a55beaf62bf0345eb15
-F src/btreeInt.h d1f713b2947a054c3532154a4d6b2bb8c4698fb54432f171966bdd06728ab1be
+F src/btree.c 87f2c3f1812b49fbb700fefc4852216af2904016b42b22c2cd5b9c254cc6665a
+F src/btree.h c64f1439377e2edf31f7c3a562586a96b71f8d0ca47e65756e7d122fd8f06928
+F src/btreeInt.h ffd66480520d9d70222171b3a026d78b80833b5cea49c89867949f3e023d5f43
F src/build.c 92b61c2be1e35a619391f17c2d1b108901ad5e4df99becc0b064a934e6ec662a
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
@@ -499,7 +499,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 7e081d33aab4a9d761c39dccf3c3872c35501565d2ed9db66301918d23bc7901
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
-F src/main.c d71b989398a4cdb4e7ece0478b763834d7732fb78dd24702d36366743853ac82
+F src/main.c e913d3c2a1743c065fee9a00debb50d5f95b289401435c49a981609f390ae537
F src/malloc.c 22d5bdd9fe88ae4fad1b91a1b9735104b82853ffef868f1f05517d60dc1875f5
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@@ -536,8 +536,8 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
-F src/shell.c.in 14385d8c121600bd9092824d5cf7646eb717137648bc342077987c49e16de216
-F src/sqlite.h.in b91e4a5b9b25eb95260be0bf9716d2bdba0da06b72eb439f41592b226f58881d
+F src/shell.c.in 9bae0c8397e7b592fb404678c4c1fc7944d9dc798a928d1eb40bcd608c33d21b
+F src/sqlite.h.in 473a79ff2c5c6d54a09af88206ea4d02c4b74558f7d29315a4ede05da8eb8732
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
F src/sqliteInt.h d8d69318b1ba3906d4860da1cd1c6b3650b81c9595e5bc360c6469a1e54e09e1
@@ -1879,7 +1879,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 ded1a75b3cf39834d38a385f38ae969b296f6c9409856b7eea08645e861b1ac2
-R d9747280ab6c456500686b04f563aa50
+P 62f7d2a61259f296ffdcb3b3ee1a13925c4563ac8ed669f8a8a63fc7bc3a0a37
+R 36c4a7f200dd414f60f8ce85e07a7d72
U drh
-Z 96026921b32a7e290f8ba5e4e39f8431
+Z c26168864fbe1f1e12628f6c3cbbb874
diff --git a/manifest.uuid b/manifest.uuid
index 417012c05c..df3b6a68d1 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-62f7d2a61259f296ffdcb3b3ee1a13925c4563ac8ed669f8a8a63fc7bc3a0a37
\ No newline at end of file
+dca5b91926431768babac28a6faf7674a5014db95caba727995b470e92b3182a
\ No newline at end of file
diff --git a/src/btree.c b/src/btree.c
index 4579121697..ff05c77264 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -112,6 +112,17 @@ int sqlite3_enable_shared_cache(int enable){
#define hasReadConflicts(a, b) 0
#endif
+#ifdef SQLITE_DEBUG
+/*
+** Return an reset the seek counter for a Btree object.
+*/
+sqlite3_uint64 sqlite3BtreeSeekCount(Btree *pBt){
+ u64 n = pBt->nSeek;
+ pBt->nSeek = 0;
+ return n;
+}
+#endif
+
/*
** Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single
** (MemPage*) as an argument. The (MemPage*) must not be NULL.
@@ -5459,6 +5470,10 @@ int sqlite3BtreeMovetoUnpacked(
}
}
+#ifdef SQLITE_DEBUG
+ pCur->pBtree->nSeek++; /* Performance measurement during testing */
+#endif
+
if( pIdxKey ){
xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);
pIdxKey->errCode = 0;
diff --git a/src/btree.h b/src/btree.h
index 4763ee04c4..4cfa685856 100644
--- a/src/btree.h
+++ b/src/btree.h
@@ -330,6 +330,12 @@ int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask);
int sqlite3BtreeIsReadonly(Btree *pBt);
int sqlite3HeaderSizeBtree(void);
+#ifdef SQLITE_DEBUG
+sqlite3_uint64 sqlite3BtreeSeekCount(Btree*);
+#else
+# define sqlite3BtreeSeekCount(X) 0
+#endif
+
#ifndef NDEBUG
int sqlite3BtreeCursorIsValid(BtCursor*);
#endif
diff --git a/src/btreeInt.h b/src/btreeInt.h
index bffe09b617..c09699fbb5 100644
--- a/src/btreeInt.h
+++ b/src/btreeInt.h
@@ -353,6 +353,9 @@ struct Btree {
u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */
Btree *pNext; /* List of other sharable Btrees from the same db */
Btree *pPrev; /* Back pointer of the same list */
+#ifdef SQLITE_DEBUG
+ u64 nSeek; /* Calls to sqlite3BtreeMovetoUnpacked() */
+#endif
#ifndef SQLITE_OMIT_SHARED_CACHE
BtLock lock; /* Object used to lock page 1 */
#endif
diff --git a/src/main.c b/src/main.c
index 917028c7bf..18deb1299d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4235,6 +4235,24 @@ int sqlite3_test_control(int op, ...){
sqlite3ResultIntReal(pCtx);
break;
}
+
+ /* sqlite3_test_control(SQLITE_TESTCTRL_SEEK_COUNT,
+ ** sqlite3 *db, // Database connection
+ ** u64 *pnSeek // Write seek count here
+ ** );
+ **
+ ** This test-control queries the seek-counter on the "main" database
+ ** file. The seek-counter is written into *pnSeek and is then reset.
+ ** The seek-count is only available if compiled with SQLITE_DEBUG.
+ */
+ case SQLITE_TESTCTRL_SEEK_COUNT: {
+ sqlite3 *db = va_arg(ap, sqlite3*);
+ u64 *pn = va_arg(ap, sqlite3_uint64*);
+ *pn = sqlite3BtreeSeekCount(db->aDb->pBt);
+ break;
+ }
+
+
}
va_end(ap);
#endif /* SQLITE_UNTESTABLE */
diff --git a/src/shell.c.in b/src/shell.c.in
index addd9779b2..dcaff91614 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -9873,6 +9873,7 @@ static int do_meta_command(char *zLine, ShellState *p){
{ "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" },
{ "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" },
{ "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" },
+ { "seek_count", SQLITE_TESTCTRL_SEEK_COUNT, "" },
};
int testctrl = -1;
int iCtrl = -1;
@@ -9935,7 +9936,6 @@ static int do_meta_command(char *zLine, ShellState *p){
/* sqlite3_test_control(int) */
case SQLITE_TESTCTRL_PRNG_SAVE:
case SQLITE_TESTCTRL_PRNG_RESTORE:
- case SQLITE_TESTCTRL_PRNG_RESET:
case SQLITE_TESTCTRL_BYTEORDER:
if( nArg==2 ){
rc2 = sqlite3_test_control(testctrl);
@@ -10009,6 +10009,14 @@ static int do_meta_command(char *zLine, ShellState *p){
}
break;
+ case SQLITE_TESTCTRL_SEEK_COUNT: {
+ u64 x = 0;
+ rc2 = sqlite3_test_control(testctrl, p->db, &x);
+ utf8_printf(p->out, "%llu\n", x);
+ isOk = 3;
+ break;
+ }
+
#ifdef YYCOVERAGE
case SQLITE_TESTCTRL_PARSER_COVERAGE:
if( nArg==2 ){
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 9a372d32bb..2a8ad56ce9 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -7739,6 +7739,7 @@ int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_PRNG_SAVE 5
#define SQLITE_TESTCTRL_PRNG_RESTORE 6
#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
+#define SQLITE_TESTCTRL_SEEK_COUNT 7
#define SQLITE_TESTCTRL_BITVEC_TEST 8
#define SQLITE_TESTCTRL_FAULT_INSTALL 9
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
From d321b6f4ad264a47c56fe752158ca528e679994d Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 1 Sep 2020 00:26:21 +0000
Subject: [PATCH 045/169] Fix a harmless compiler warning.
FossilOrigin-Name: 3ca0b7d54d73d07cd6b32e650a809174bb1cd66ce5ecdb36f65b70899ea05824
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/main.c | 1 +
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/manifest b/manifest
index 109f2f8d59..035ac11919 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C New\stest-control\sthat\sreturns\sthe\snumber\sof\scalls\sto\nsqlite3BtreeMovetoUnpacked()\son\sthe\smain\sdatabase\sand\sthen\sresets\sthe\ncounter.\s\sThis\sonly\sworks\sfor\sSQLITE_DEBUG\sbuilds.
-D 2020-08-31T18:49:04.199
+C Fix\sa\sharmless\scompiler\swarning.
+D 2020-09-01T00:26:21.415
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -499,7 +499,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 7e081d33aab4a9d761c39dccf3c3872c35501565d2ed9db66301918d23bc7901
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
-F src/main.c e913d3c2a1743c065fee9a00debb50d5f95b289401435c49a981609f390ae537
+F src/main.c 1b7b95b6168e29c8235042b0b7102ecbb9e6765bbc82b74f2b96294b230f60f3
F src/malloc.c 22d5bdd9fe88ae4fad1b91a1b9735104b82853ffef868f1f05517d60dc1875f5
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@@ -1879,7 +1879,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 62f7d2a61259f296ffdcb3b3ee1a13925c4563ac8ed669f8a8a63fc7bc3a0a37
-R 36c4a7f200dd414f60f8ce85e07a7d72
+P dca5b91926431768babac28a6faf7674a5014db95caba727995b470e92b3182a
+R a054e4b5c94ece883c5cccfc8d30d6f5
U drh
-Z c26168864fbe1f1e12628f6c3cbbb874
+Z d20f9b26275b88faf3b4eb1260a25f4c
diff --git a/manifest.uuid b/manifest.uuid
index df3b6a68d1..3241b00ddb 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-dca5b91926431768babac28a6faf7674a5014db95caba727995b470e92b3182a
\ No newline at end of file
+3ca0b7d54d73d07cd6b32e650a809174bb1cd66ce5ecdb36f65b70899ea05824
\ No newline at end of file
diff --git a/src/main.c b/src/main.c
index 18deb1299d..2cc092e92a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4249,6 +4249,7 @@ int sqlite3_test_control(int op, ...){
sqlite3 *db = va_arg(ap, sqlite3*);
u64 *pn = va_arg(ap, sqlite3_uint64*);
*pn = sqlite3BtreeSeekCount(db->aDb->pBt);
+ (void)db; /* Silence harmless unused variable warning */
break;
}
From fa17e134b2a006b4f5463743a72ab720502a5ecc Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 1 Sep 2020 01:52:03 +0000
Subject: [PATCH 046/169] Improvements to the IN-early-out optimization so that
it works more efficiently when there are two or more indexed IN clauses on a
single table.
FossilOrigin-Name: 35505c68c1945c35babd2496e02bc4907a15c8e7b8d77f05f230bd0e9d4891d7
---
manifest | 18 +++++++++---------
manifest.uuid | 2 +-
src/vdbe.c | 48 +++++++++++++++++++++++++++++++-----------------
src/vdbeInt.h | 2 +-
src/wherecode.c | 12 +++++++-----
test/where.test | 4 ++--
6 files changed, 51 insertions(+), 35 deletions(-)
diff --git a/manifest b/manifest
index 035ac11919..1b57c1c173 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sharmless\scompiler\swarning.
-D 2020-09-01T00:26:21.415
+C Improvements\sto\sthe\sIN-early-out\soptimization\sso\sthat\sit\sworks\smore\nefficiently\swhen\sthere\sare\stwo\sor\smore\sindexed\sIN\sclauses\son\sa\ssingle\stable.
+D 2020-09-01T01:52:03.629
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,9 +607,9 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c c5da1456c9de0993055be9c10ebc5f5eb2be75d28cb01c8abc2f083923835a2d
+F src/vdbe.c 6430a540012b8b4c81076565804fcb979040e1b1a43ce76d2381863884155d84
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
-F src/vdbeInt.h 762abffb7709f19c2cb74af1bba73a900f762e64f80d69c31c9ae89ed1066b60
+F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
F src/vdbeaux.c b39d2e0e7126cd4629874dd7b67162b9f0d200b620d2b4c16d400949a2f1094b
F src/vdbeblob.c 253ed82894924c362a7fa3079551d3554cd1cdace39aa833da77d3bc67e7c1b1
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c 23f47e845e304a41d0b221bf67bd170014ae08b673076813fcd945dda1a3d4af
F src/whereInt.h eb8c2847fb464728533777efec1682b3c074224293b2da73513c61a609efbeab
-F src/wherecode.c 110fa357bf453e0d30bf5ebb2cc86ea34a3631c39b857f30c228fd325cb53ae7
+F src/wherecode.c 8b1176a3b7d4d61f78b0516bb7f6bb3803c658a6565663b8414c3b5d37a02eaa
F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1710,7 +1710,7 @@ F test/walthread.test 14b20fcfa6ae152f5d8e12f5dc8a8a724b7ef189f5d8ef1e2ceab79f2a
F test/walvfs.test a2913001a83b19c1d20220e556cee14d87d47ecb6949b5e0a2e9e2590abecf1e
F test/wapp.tcl b440cd8cf57953d3a49e7ee81e6a18f18efdaf113b69f7d8482b0710a64566ec
F test/wapptest.tcl 899594e25684861d5b0c0880fb012364def50ef8097041b8ddf74be5ba7fa270 x
-F test/where.test f5e62453537e5b335b69f3b09f8a02ce3328289fad5d866e25371284b837d78d
+F test/where.test e713c0c64e3e6b062235e39a2f7e5508c517df16b63d69fd786e26bc7330b1c6
F test/where2.test 478d2170637b9211f593120648858593bf2445a1
F test/where3.test 2341a294e17193a6b1699ea7f192124a5286ca6acfcc3f4b06d16c931fbcda2c
F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8
@@ -1879,7 +1879,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 dca5b91926431768babac28a6faf7674a5014db95caba727995b470e92b3182a
-R a054e4b5c94ece883c5cccfc8d30d6f5
+P 3ca0b7d54d73d07cd6b32e650a809174bb1cd66ce5ecdb36f65b70899ea05824
+R 16504c659945ee05da548d177d28a416
U drh
-Z d20f9b26275b88faf3b4eb1260a25f4c
+Z d1eb95f49e8d2ff17d6f9cd7b555126f
diff --git a/manifest.uuid b/manifest.uuid
index 3241b00ddb..880e8c42ce 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-3ca0b7d54d73d07cd6b32e650a809174bb1cd66ce5ecdb36f65b70899ea05824
\ No newline at end of file
+35505c68c1945c35babd2496e02bc4907a15c8e7b8d77f05f230bd0e9d4891d7
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index bc5addabab..a579b4ea11 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4383,22 +4383,31 @@ seek_not_found:
break;
}
-/* Opcode: SeekHit P1 P2 * * *
-** Synopsis: seekHit=P2
+/* Opcode: SeekHit P1 P2 P3 * *
+** Synopsis: set P2<=seekHit<=P3
**
-** Set the seekHit flag on cursor P1 to the value in P2.
-** The seekHit flag is used by the IfNoHope opcode.
+** Increase or decrease the seekHit value for cursor P1, if necessary,
+** so that it is no less than P2 and no greater than P3.
**
-** P1 must be a valid b-tree cursor. P2 must be a boolean value,
-** either 0 or 1.
+** The seekHit integer represents the maximum of terms in an index for which
+** there is known to be at least one match. If the seekHit value is smaller
+** than the total number of equality terms in an index lookup, then the
+** OP_IfNoHope opcode might run to see if the IN loop can be abandoned
+** early, thus saving work. This is part of the IN-early-out optimization.
+**
+** P1 must be a valid b-tree cursor.
*/
case OP_SeekHit: {
VdbeCursor *pC;
assert( pOp->p1>=0 && pOp->p1nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
- assert( pOp->p2==0 || pOp->p2==1 );
- pC->seekHit = pOp->p2 & 1;
+ assert( pOp->p3>=pOp->p2 );
+ if( pC->seekHitp2 ){
+ pC->seekHit = pOp->p2;
+ }else if( pC->seekHit>pOp->p3 ){
+ pC->seekHit = pOp->p3;
+ }
break;
}
@@ -4456,16 +4465,20 @@ case OP_IfNotOpen: { /* jump */
** Synopsis: key=r[P3@P4]
**
** Register P3 is the first of P4 registers that form an unpacked
-** record.
+** record. Cursor P1 is an index btree. P2 is a jump destination.
+** In other words, the operands to this opcode are the same as the
+** operands to OP_NotFound and OP_IdxGT.
**
-** Cursor P1 is on an index btree. If the seekHit flag is set on P1, then
-** this opcode is a no-op. But if the seekHit flag of P1 is clear, then
-** check to see if there is any entry in P1 that matches the
-** prefix identified by P3 and P4. If no entry matches the prefix,
-** jump to P2. Otherwise fall through.
+** This opcode is an optimization attempt only. If this opcode always
+** falls through, the correct answer is still obtained, but extra works
+** is performed.
**
-** This opcode behaves like OP_NotFound if the seekHit
-** flag is clear and it behaves like OP_Noop if the seekHit flag is set.
+** A value of N in the seekHit flag of cursor P1 means that there exists
+** a key P3:N that will match some record in the index. We want to know
+** if it is possible for a record P3:P4 to match some record in the
+** index. If it is not possible, we can skips some work. So if seekHit
+** is less than P4, attempt to find out if a match is possible by running
+** OP_NotFound.
**
** This opcode is used in IN clause processing for a multi-column key.
** If an IN clause is attached to an element of the key other than the
@@ -4507,7 +4520,7 @@ case OP_IfNoHope: { /* jump, in3 */
assert( pOp->p1>=0 && pOp->p1nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
- if( pC->seekHit ) break;
+ if( pC->seekHit>=pOp->p4.i ) break;
/* Fall through into OP_NotFound */
/* no break */ deliberate_fall_through
}
@@ -4589,6 +4602,7 @@ case OP_Found: { /* jump, in3 */
}else{
VdbeBranchTaken(takeJump||alreadyExists==0,2);
if( takeJump || !alreadyExists ) goto jump_to_p2;
+ if( pOp->opcode==OP_IfNoHope ) pC->seekHit = pOp->p4.i;
}
break;
}
diff --git a/src/vdbeInt.h b/src/vdbeInt.h
index 901569742f..7d22cb8093 100644
--- a/src/vdbeInt.h
+++ b/src/vdbeInt.h
@@ -86,7 +86,7 @@ struct VdbeCursor {
Bool isEphemeral:1; /* True for an ephemeral table */
Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
- Bool seekHit:1; /* See the OP_SeekHit and OP_IfNoHope opcodes */
+ u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */
Btree *pBtx; /* Separate file holding temporary table */
i64 seqCount; /* Sequence counter */
u32 *aAltMap; /* Mapping from table to index column numbers */
diff --git a/src/wherecode.c b/src/wherecode.c
index 145b6fa5f5..591f267e82 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -570,6 +570,9 @@ static int codeEqualityTerm(
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
+ if( iEq>0 ){
+ pLoop->wsFlags |= WHERE_IN_EARLYOUT;
+ }
i = pLevel->u.in.nIn;
pLevel->u.in.nIn += nEq;
@@ -596,7 +599,6 @@ static int codeEqualityTerm(
if( iEq>0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
- pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}else{
pIn->nPrefix = 0;
}
@@ -606,6 +608,9 @@ static int codeEqualityTerm(
pIn++;
}
}
+ if( iEq>0 ){
+ sqlite3VdbeAddOp3(v, OP_SeekHit, pLevel->iIdxCur, 0, iEq);
+ }
}else{
pLevel->u.in.nIn = 0;
}
@@ -1789,9 +1794,6 @@ Bitmask sqlite3WhereCodeOneLoopStart(
** above has already left the cursor sitting on the correct row,
** so no further seeking is needed */
}else{
- if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
- sqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur);
- }
if( regBignull ){
sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull);
VdbeComment((v, "NULL-scan pass ctr"));
@@ -1902,7 +1904,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
}
if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
- sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1);
+ sqlite3VdbeAddOp3(v, OP_SeekHit, iIdxCur, nEq, nEq);
}
/* Seek the table cursor, if required */
diff --git a/test/where.test b/test/where.test
index 9b072da677..fa3bcd836c 100644
--- a/test/where.test
+++ b/test/where.test
@@ -490,12 +490,12 @@ ifcapable subquery {
count {
SELECT * FROM t1 WHERE x IN (1,7) AND y IN (9,10) ORDER BY 1;
}
- } {2 1 9 4}
+ } {2 1 9 5}
do_test where-5.15 {
count {
SELECT * FROM t1 WHERE x IN (1,7) AND y IN (9,16) ORDER BY 1;
}
- } {2 1 9 3 1 16 8}
+ } {2 1 9 3 1 16 9}
do_test where-5.100 {
db eval {
SELECT w, x, y FROM t1 WHERE x IN (1,5) AND y IN (9,8,3025,1000,3969)
From 60c71b02ca6d2a964ab4ae9bbdd7dc0814b7402d Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 1 Sep 2020 11:20:03 +0000
Subject: [PATCH 047/169] Lemon updates: (1) include the #defines for all
tokens in the generated C file, so that the C-file can be stand-alone. (2)
If the grammar begins with a %include {...} directive on line one, make that
directive the header for the generated C file. (3) Enhance the lemon.html
documentation.
FossilOrigin-Name: 84d54eb35716174195ee7e5ac846f47308e5dbb0056e8ff568daa133860bab74
---
doc/lemon.html | 249 ++++++++++++++++++++++++++++++++++++++++---------
manifest | 18 ++--
manifest.uuid | 2 +-
src/parse.y | 16 +++-
tool/lemon.c | 50 ++++++++--
tool/lempar.c | 11 +--
6 files changed, 270 insertions(+), 76 deletions(-)
diff --git a/doc/lemon.html b/doc/lemon.html
index b1f871481d..bd078c8ec7 100644
--- a/doc/lemon.html
+++ b/doc/lemon.html
@@ -2,7 +2,8 @@
The Lemon Parser Generator
-
+
+
The Lemon Parser Generator
Lemon is an LALR(1) parser generator for C.
@@ -23,7 +24,37 @@ or embedded controllers.
This document is an introduction to the Lemon
parser generator.
-Security Note
+
+1.0 Table of Contents
+
+
+
+2.0 Security Note
The language parser code created by Lemon is very robust and
is well-suited for use in internet-facing applications that need to
@@ -43,26 +74,29 @@ To summarize:
- The "lemon.exe" command line tool itself → Not so much
-Theory of Operation
+
+3.0 Theory of Operation
-The main goal of Lemon is to translate a context free grammar (CFG)
+
Lemon is computer program that translates a context free grammar (CFG)
for a particular language into C code that implements a parser for
that language.
-The program has two inputs:
+The Lemon program has two inputs:
- The grammar specification.
- A parser template file.
Typically, only the grammar specification is supplied by the programmer.
-Lemon comes with a default parser template which works fine for most
-applications. But the user is free to substitute a different parser
-template if desired.
+Lemon comes with a default parser template
+("lempar.c")
+that works fine for most applications. But the user is free to substitute
+a different parser template if desired.
Depending on command-line options, Lemon will generate up to
three output files.
-- C code to implement the parser.
-
- A header file defining an integer ID for each terminal symbol.
+
- C code to implement a parser for the input grammar.
+
- A header file defining an integer ID for each terminal symbol
+ (or "token").
- An information file that describes the states of the generated parser
automaton.
@@ -84,7 +118,8 @@ is the header file that defines numerical values for all
terminal symbols, and the last is the report that explains
the states used by the parser automaton.
-Command Line Options
+
+3.1 Command Line Options
The behavior of Lemon can be modified using command-line options.
You can obtain a list of the available command-line options together
@@ -134,7 +169,8 @@ Use file as the template for the generated C-code parser implementation.
Print the Lemon version number.
-The Parser Interface
+
+3.2 The Parser Interface
Lemon doesn't generate a complete, working program. It only generates
a few subroutines that implement a parser. This section describes
@@ -275,7 +311,61 @@ or calls an action routine. Each such message is prefaced using
the text given by zPrefix. This debugging output can be turned off
by calling ParseTrace() again with a first argument of NULL (0).
-Differences With YACC and BISON
+
+3.2.1 Allocating The Parse Object On Stack
+
+If all calls to the Parse() interface are made from within
+%code directives, then the parse
+object can be allocated from the stack rather than from the heap.
+These are the steps:
+
+
+- Declare a local variable of type "yyParser"
+
- Initialize the variable using ParseInit()
+
- Pass a pointer to the variable in calls ot Parse()
+
- Deallocate substructure in the parse variable using ParseFinalize().
+
+
+The following code illustrates how this is done:
+
+
+ ParseFile(){
+ yyParser x;
+ ParseInit( &x );
+ while( GetNextToken(pTokenizer,&hTokenId, &sToken) ){
+ Parse(&x, hTokenId, sToken);
+ }
+ Parse(&x, 0, sToken);
+ ParseFinalize( &x );
+ }
+
+
+
+3.2.2 Interface Summary
+
+Here is a quick overview of the C-language interface to a
+Lemon-generated parser:
+
+
+void *ParseAlloc( (void*(*malloc)(size_t) );
+void ParseFree(void *pParser, (void(*free)(void*) );
+void Parse(void *pParser, int tokenCode, ParseTOKENTYPE token, ...);
+void ParseTrace(FILE *stream, char *zPrefix);
+
+
+Notes:
+
+
+
+3.3 Differences With YACC and BISON
Programmers who have previously used the yacc or bison parser
generator will notice several important differences between yacc and/or
@@ -296,10 +386,39 @@ believe that the Lemon way of doing things is better.
Updated as of 2016-02-16:
The text above was written in the 1990s.
We are told that Bison has lately been enhanced to support the
-tokenizer-calls-parser paradigm used by Lemon, and to obviate the
+tokenizer-calls-parser paradigm used by Lemon, eliminating the
need for global variables.
-Input File Syntax
+
+3.4 Building The "lemon" or "lemon.exe" Executable
+
+The "lemon" or "lemon.exe" program is built from a single file
+of C-code named
+"lemon.c".
+The Lemon source code is generic C89 code that uses
+no unusual or non-standard libraries. Any
+reasonable C compiler should suffice to compile the lemon program.
+A command-line like the following will usually work:
+
+
+cc -o lemon lemon.c
+
On Windows machines with Visual C++ installed, bring up a
+"VS20NN x64 Native Tools Command Prompt" window and enter:
+
+
+cl lemon.c
+
+
+Compiling Lemon really is that simple.
+Additional compiler options such as
+"-O2" or "-g" or "-Wall" can be added if desired, but they are not
+necessary.
+
+
+
+4.0 Input File Syntax
The main purpose of the grammar specification file for Lemon is
to define the grammar for the parser. But the input file also
@@ -313,7 +432,8 @@ declaration can occur at any point in the file. Lemon ignores
whitespace (except where it is needed to separate tokens), and it
honors the same commenting conventions as C and C++.
-Terminals and Nonterminals
+
+4.1 Terminals and Nonterminals
A terminal symbol (token) is any string of alphanumeric
and/or underscore characters
@@ -338,7 +458,8 @@ this: ')' or '$'. Lemon does not allow this alternative form for
terminal symbols. With Lemon, all symbols, terminals and nonterminals,
must have alphanumeric names.
-Grammar Rules
+
+4.2 Grammar Rules
The main component of a Lemon grammar file is a sequence of grammar
rules.
@@ -423,7 +544,7 @@ allocated by the values of terminals and nonterminals on the
right-hand side of a rule.
-Precedence Rules
+4.3 Precedence Rules
Lemon resolves parsing ambiguities in exactly the same way as
yacc and bison. A shift-reduce conflict is resolved in favor
@@ -539,7 +660,8 @@ as follows:
appears first in the grammar, and report a parsing conflict.
-Special Directives
+
+4.4 Special Directives
The input grammar to Lemon consists of grammar rules and special
directives. We've described all the grammar rules, so now we'll
@@ -586,7 +708,7 @@ other than that, the order of directives in Lemon is arbitrary.
following sections:
-The %code directive
+4.4.1 The %code directive
The %code directive is used to specify additional C code that
is added to the end of the main output file. This is similar to
@@ -597,8 +719,11 @@ the %include directive except that
a tokenizer or even the "main()" function
as part of the output file.
+There can be multiple %code directives. The arguments of
+all %code directives are concatenated.
+
-The %default_destructor directive
+4.4.2 The %default_destructor directive
The %default_destructor directive specifies a destructor to
use for non-terminals that do not have their own destructor
@@ -612,14 +737,14 @@ a convenient way to specify the same destructor for all those
non-terminals using a single statement.
-The %default_type directive
+4.4.3 The %default_type directive
The %default_type directive specifies the data type of non-terminal
symbols that do not have their own data type defined using a separate
%type directive.
-The %destructor directive
+4.4.4 The %destructor directive
The %destructor directive is used to specify a destructor for
a non-terminal symbol.
@@ -669,7 +794,7 @@ allocated objects when they go out of scope.
To do the same using yacc or bison is much more difficult.
-The %extra_argument directive
+4.4.5 The %extra_argument directive
The %extra_argument directive instructs Lemon to add a 4th parameter
to the parameter list of the Parse() function it generates. Lemon
@@ -691,7 +816,7 @@ is passed in on the ParseAlloc() or ParseInit() routines instead of
on Parse().
-The %extra_context directive
+4.4.6 The %extra_context directive
The %extra_context directive instructs Lemon to add a 2nd parameter
to the parameter list of the ParseAlloc() and ParseInit() functions. Lemon
@@ -711,7 +836,7 @@ a variable named "pAbc" that is the value of that 2nd parameter.
is passed in on the Parse() routine instead of on ParseAlloc()/ParseInit().
-The %fallback directive
+4.4.7 The %fallback directive
The %fallback directive specifies an alternative meaning for one
or more tokens. The alternative meaning is tried if the original token
@@ -741,7 +866,7 @@ arguments are tokens which fall back to the token identified by the first
argument.
-The %if directive and its friends
+4.4.8 The %if directive and its friends
The %if, %ifdef, %ifndef, %else,
and %endif directives
@@ -772,7 +897,7 @@ intended to be a single preprocessor symbol name, not a general expression.
Use the "%if" directive for general expressions.
-The %include directive
+4.4.9 The %include directive
The %include directive specifies C code that is included at the
top of the generated parser. You can include any text you want —
@@ -796,7 +921,7 @@ grammar call functions that are prototyped in unistd.h.
the end of the generated parser.
-The %left directive
+4.4.10 The %left directive
The %left directive is used (along with the
%right and
@@ -826,7 +951,7 @@ operators. For this reason, it is recommended that you use %left
rather than %right whenever possible.
-The %name directive
+4.4.11 The %name directive
By default, the functions generated by Lemon all begin with the
five-character string "Parse". You can change this string to something
@@ -848,7 +973,7 @@ functions named
parsers and link them all into the same executable.
-The %nonassoc directive
+4.4.12 The %nonassoc directive
This directive is used to assign non-associative precedence to
one or more terminal symbols. See the section on
@@ -857,7 +982,7 @@ or on the %left directive
for additional information.
-The %parse_accept directive
+4.4.13 The %parse_accept directive
The %parse_accept directive specifies a block of C code that is
executed whenever the parser accepts its input string. To "accept"
@@ -873,7 +998,7 @@ without error.
-The %parse_failure directive
+4.4.14 The %parse_failure directive
The %parse_failure directive specifies a block of C code that
is executed whenever the parser fails complete. This code is not
@@ -888,7 +1013,7 @@ only invoked when parsing is unable to continue.
-The %right directive
+4.4.15 The %right directive
This directive is used to assign right-associative precedence to
one or more terminal symbols. See the section on
@@ -896,7 +1021,7 @@ one or more terminal symbols. See the section on
or on the %left directive for additional information.
-The %stack_overflow directive
+4.4.16 The %stack_overflow directive
The %stack_overflow directive specifies a block of C code that
is executed if the parser's internal stack ever overflows. Typically
@@ -925,7 +1050,7 @@ For example, do rules like this:
-The %stack_size directive
+4.4.17 The %stack_size directive
If stack overflow is a problem and you can't resolve the trouble
by using left-recursion, then you might want to increase the size
@@ -938,7 +1063,7 @@ with a stack of the requested size. The default value is 100.
-The %start_symbol directive
+4.4.18 The %start_symbol directive
By default, the start symbol for the grammar that Lemon generates
is the first non-terminal that appears in the grammar file. But you
@@ -950,18 +1075,18 @@ can choose a different start symbol using the
-
The %syntax_error directive
+4.4.19 The %syntax_error directive
See Error Processing.
-The %token_class directive
+4.4.20 The %token_class directive
Undocumented. Appears to be related to the MULTITERMINAL concept.
Implementation.
-The %token_destructor directive
+4.4.21 The %token_destructor directive
The %destructor directive assigns a destructor to a non-terminal
symbol. (See the description of the
@@ -977,7 +1102,7 @@ Other than that, the token destructor works just like the non-terminal
destructors.
-The %token_prefix directive
+4.4.22 The %token_prefix directive
Lemon generates #defines that assign small integer constants
to each terminal symbol in the grammar. If desired, Lemon will
@@ -1004,7 +1129,7 @@ to each of the #defines it generates.
-The %token_type and %type directives
+4.4.23 The %token_type and %type directives
These directives are used to specify the data types for values
on the parser's stack associated with terminal and non-terminal
@@ -1041,7 +1166,7 @@ entry parser stack will require 100K of heap space. If you are willing
and able to pay that price, fine. You just need to know.
-The %wildcard directive
+4.4.24 The %wildcard directive
The %wildcard directive is followed by a single token name and a
period. This directive specifies that the identified token should
@@ -1052,7 +1177,7 @@ the wildcard token and some other token, the other token is always used.
The wildcard token is only matched if there are no alternatives.
-Error Processing
+5.0 Error Processing
After extensive experimentation over several years, it has been
discovered that the error recovery strategy used by yacc is about
@@ -1075,5 +1200,41 @@ to begin parsing a new file. This is what will happen at the very
first syntax error, of course, if there are no instances of the
"error" non-terminal in your grammar.
+
+6.0 History of Lemon
+
+Lemon was originally written by Richard Hipp sometime in the late
+1980s on a Sun4 Workstation using K&R C.
+There was a companion LL(1) parser generator program named "Lime", the
+source code to which as been lost.
+
+The lemon.c source file was originally many separate files that were
+compiled together to generate the "lemon" executable. Sometime in the
+1990s, the individual source code files were combined together into
+the current single large "lemon.c" source file. You can still see traces
+of original filenames in the code.
+
+Since 2001, Lemon has been part of the
+SQLite project and the source code
+to Lemon has been managed as a part of the
+SQLite source tree in the following
+files:
+
+
+
+
+7.0 Copyright
+
+All of the source code to Lemon, including the template parser file
+"lempar.c" and this documentation file ("lemon.html") are in the public
+domain. You can use the code for any purpose and without attribution.
+
+The code comes with no warranty. If it breaks, you get to keep both
+pieces.
+
diff --git a/manifest b/manifest
index 1b57c1c173..37b2099bb2 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improvements\sto\sthe\sIN-early-out\soptimization\sso\sthat\sit\sworks\smore\nefficiently\swhen\sthere\sare\stwo\sor\smore\sindexed\sIN\sclauses\son\sa\ssingle\stable.
-D 2020-09-01T01:52:03.629
+C Lemon\supdates:\s\s(1)\sinclude\sthe\s#defines\sfor\sall\stokens\sin\sthe\sgenerated\sC\nfile,\sso\sthat\sthe\sC-file\scan\sbe\sstand-alone.\s\s(2)\sIf\sthe\sgrammar\sbegins\swith\na\s%include\s{...}\sdirective\son\sline\sone,\smake\sthat\sdirective\sthe\sheader\sfor\nthe\sgenerated\sC\sfile.\s\s(3)\sEnhance\sthe\slemon.html\sdocumentation.
+D 2020-09-01T11:20:03.785
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -38,7 +38,7 @@ F configure 63af83d31b9fdf304f2dbb1e1638530d4ceff31702d1e19550d1fbf3bdf9471e x
F configure.ac 40d01e89cb325c28b33f5957e61fede0bd17da2b5e37d9b223a90c8a318e88d4
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
-F doc/lemon.html 5155bf346e59385ac8d14da0c1e895d8dbc5d225a7d93d3f8249cbfb3c938f55
+F doc/lemon.html c5d8ba85ac1daef7be8c2d389899480eb62451ff5c09b0c28ff8157bb8770746
F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
F doc/trusted-schema.md 33625008620e879c7bcfbbfa079587612c434fa094d338b08242288d358c3e8a
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
@@ -524,7 +524,7 @@ F src/os_win.c a2149ff0a85c1c3f9cc102a46c673ce87e992396ba3411bfb53db66813b32f1d
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
F src/pager.h 4bf9b3213a4b2bebbced5eaa8b219cf25d4a82f385d093cd64b7e93e5285f66f
-F src/parse.y 2ca57a8383e9cf9e1140706a85a4b357d6c09cfea7ba9098746a28bc8212441a
+F src/parse.y 9ce4dfb772608ed5bd3c32f33e943e021e3b06cfd2c01932d4280888fdd2ebed
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
@@ -1798,8 +1798,8 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c 600a58b9d1b8ec5419373982428e927ca208826edacb91ca42ab94514d006039
-F tool/lempar.c e8899b28488f060d0ff931539ea6311b16b22dce068c086c788a06d5e8d01ab7
+F tool/lemon.c 5206111b82f279115c1bfd25a2d859e2b99ab068fc6cddd124d93efd7112cc20
+F tool/lempar.c dc1f5e8a0847c2257b0b069c61e290227062c4d75f5b5a0797b75b08b1c00405
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
@@ -1879,7 +1879,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 3ca0b7d54d73d07cd6b32e650a809174bb1cd66ce5ecdb36f65b70899ea05824
-R 16504c659945ee05da548d177d28a416
+P 35505c68c1945c35babd2496e02bc4907a15c8e7b8d77f05f230bd0e9d4891d7
+R ca40e65faf80d0ec5a9ea286af461844
U drh
-Z d1eb95f49e8d2ff17d6f9cd7b555126f
+Z b58ed847c13aa05b57f422755df0e3ad
diff --git a/manifest.uuid b/manifest.uuid
index 880e8c42ce..6136c16e36 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-35505c68c1945c35babd2496e02bc4907a15c8e7b8d77f05f230bd0e9d4891d7
\ No newline at end of file
+84d54eb35716174195ee7e5ac846f47308e5dbb0056e8ff568daa133860bab74
\ No newline at end of file
diff --git a/src/parse.y b/src/parse.y
index c44d6563a4..d3ec2b3da6 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -1,5 +1,6 @@
+%include {
/*
-** 2001 September 15
+** 2001-09-15
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
@@ -9,11 +10,16 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
-** This file contains SQLite's grammar for SQL. Process this file
-** using the lemon parser generator to generate C code that runs
-** the parser. Lemon will also generate a header file containing
-** numeric codes for all of the tokens.
+** This file contains SQLite's SQL parser.
+**
+** The canonical source code to this file ("parse.y") is a Lemon grammar
+** file that specifies the input grammar and actions to take while parsing.
+** That input file is processed by Lemon to generate a C-language
+** implementation of a parser for the given grammer. You might be reading
+** this comment as part of the translated C-code. Edits should be made
+** to the original parse.y sources.
*/
+}
// All token codes are small integers with #defines that begin with "TK_"
%token_prefix TK_
diff --git a/tool/lemon.c b/tool/lemon.c
index 40e4e2894f..97e5fab440 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -2638,8 +2638,10 @@ static void parseonetoken(struct pstate *psp)
}
nOld = lemonStrlen(zOld);
n = nOld + nNew + 20;
- addLineMacro = !psp->gp->nolinenosflag && psp->insertLineMacro &&
- (psp->decllinenoslot==0 || psp->decllinenoslot[0]!=0);
+ addLineMacro = !psp->gp->nolinenosflag
+ && psp->insertLineMacro
+ && psp->tokenlineno>1
+ && (psp->decllinenoslot==0 || psp->decllinenoslot[0]!=0);
if( addLineMacro ){
for(z=psp->filename, nBack=0; *z; z++){
if( *z=='\\' ) nBack++;
@@ -3617,6 +3619,16 @@ PRIVATE void tplt_xfer(char *name, FILE *in, FILE *out, int *lineno)
}
}
+/* Skip forward past the header of the template file to the first "%%"
+*/
+PRIVATE void tplt_skip_header(FILE *in, int *lineno)
+{
+ char line[LINESIZE];
+ while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){
+ (*lineno)++;
+ }
+}
+
/* The next function finds the template file and opens it, returning
** a pointer to the opened file. */
PRIVATE FILE *tplt_open(struct lemon *lemp)
@@ -4287,6 +4299,7 @@ void ReportTable(
int mnTknOfst, mxTknOfst;
int mnNtOfst, mxNtOfst;
struct axset *ax;
+ char *prefix;
lemp->minShiftReduce = lemp->nstate;
lemp->errAction = lemp->minShiftReduce + lemp->nrule;
@@ -4375,7 +4388,22 @@ void ReportTable(
fprintf(sql, "COMMIT;\n");
}
lineno = 1;
- tplt_xfer(lemp->name,in,out,&lineno);
+
+ /* The first %include directive begins with a C-language comment,
+ ** then skip over the header comment of the template file
+ */
+ if( lemp->include==0 ) lemp->include = "";
+ for(i=0; ISSPACE(lemp->include[i]); i++){
+ if( lemp->include[i]=='\n' ){
+ lemp->include += i+1;
+ i = -1;
+ }
+ }
+ if( lemp->include[0]=='/' ){
+ tplt_skip_header(in,&lineno);
+ }else{
+ tplt_xfer(lemp->name,in,out,&lineno);
+ }
/* Generate the include code, if any */
tplt_print(out,lemp,lemp->include,&lineno);
@@ -4387,17 +4415,19 @@ void ReportTable(
tplt_xfer(lemp->name,in,out,&lineno);
/* Generate #defines for all tokens */
+ if( lemp->tokenprefix ) prefix = lemp->tokenprefix;
+ else prefix = "";
if( mhflag ){
const char *prefix;
fprintf(out,"#if INTERFACE\n"); lineno++;
- if( lemp->tokenprefix ) prefix = lemp->tokenprefix;
- else prefix = "";
- for(i=1; interminal; i++){
- fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i);
- lineno++;
- }
- fprintf(out,"#endif\n"); lineno++;
+ }else{
+ fprintf(out,"#ifndef %s%s\n", prefix, lemp->symbols[1]->name);
}
+ for(i=1; interminal; i++){
+ fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i);
+ lineno++;
+ }
+ fprintf(out,"#endif\n"); lineno++;
tplt_xfer(lemp->name,in,out,&lineno);
/* Generate the defines */
diff --git a/tool/lempar.c b/tool/lempar.c
index c82e33298a..ef3148551e 100644
--- a/tool/lempar.c
+++ b/tool/lempar.c
@@ -22,17 +22,13 @@
** The following is the concatenation of all %include directives from the
** input grammar file:
*/
-#include
-#include
/************ Begin %include sections from the grammar ************************/
%%
/**************** End of %include directives **********************************/
-/* These constants specify the various numeric values for terminal symbols
-** in a format understandable to "makeheaders". This section is blank unless
-** "lemon" is run with the "-m" command-line option.
-***************** Begin makeheaders token definitions *************************/
+/* These constants specify the various numeric values for terminal symbols.
+***************** Begin token definitions *************************************/
%%
-/**************** End makeheaders token definitions ***************************/
+/**************** End token definitions ***************************************/
/* The next sections is a series of control #defines.
** various aspects of the generated parser.
@@ -229,6 +225,7 @@ typedef struct yyParser yyParser;
#ifndef NDEBUG
#include
+#include
static FILE *yyTraceFILE = 0;
static char *yyTracePrompt = 0;
#endif /* NDEBUG */
From 512aa78ca28981229858e0fd98aaba1158b6e8af Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 1 Sep 2020 12:26:55 +0000
Subject: [PATCH 048/169] In the Lemon output, add a prefix comment that
explains that the output file is automatically generated and shows the name
of the source file.
FossilOrigin-Name: d34caf3bb63d0512ea116a8c8c8343b76aa39441bd4b3e98231747a705b91d54
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
tool/lemon.c | 4 ++++
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/manifest b/manifest
index 37b2099bb2..c80c5cffe6 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Lemon\supdates:\s\s(1)\sinclude\sthe\s#defines\sfor\sall\stokens\sin\sthe\sgenerated\sC\nfile,\sso\sthat\sthe\sC-file\scan\sbe\sstand-alone.\s\s(2)\sIf\sthe\sgrammar\sbegins\swith\na\s%include\s{...}\sdirective\son\sline\sone,\smake\sthat\sdirective\sthe\sheader\sfor\nthe\sgenerated\sC\sfile.\s\s(3)\sEnhance\sthe\slemon.html\sdocumentation.
-D 2020-09-01T11:20:03.785
+C In\sthe\sLemon\soutput,\sadd\sa\sprefix\scomment\sthat\sexplains\sthat\sthe\soutput\sfile\nis\sautomatically\sgenerated\sand\sshows\sthe\sname\sof\sthe\ssource\sfile.
+D 2020-09-01T12:26:55.781
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1798,7 +1798,7 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c 5206111b82f279115c1bfd25a2d859e2b99ab068fc6cddd124d93efd7112cc20
+F tool/lemon.c 01eff5008ba46e98f4b954317bfe57ea29b836e6d3e72e1bbdaad4ca3db501b3
F tool/lempar.c dc1f5e8a0847c2257b0b069c61e290227062c4d75f5b5a0797b75b08b1c00405
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
@@ -1879,7 +1879,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 35505c68c1945c35babd2496e02bc4907a15c8e7b8d77f05f230bd0e9d4891d7
-R ca40e65faf80d0ec5a9ea286af461844
+P 84d54eb35716174195ee7e5ac846f47308e5dbb0056e8ff568daa133860bab74
+R 7f45e5b59f1c52d29dee23ebb0c2337a
U drh
-Z b58ed847c13aa05b57f422755df0e3ad
+Z 0e6fd8fbc683d31bd259b25e22ecc736
diff --git a/manifest.uuid b/manifest.uuid
index 6136c16e36..12efad1e94 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-84d54eb35716174195ee7e5ac846f47308e5dbb0056e8ff568daa133860bab74
\ No newline at end of file
+d34caf3bb63d0512ea116a8c8c8343b76aa39441bd4b3e98231747a705b91d54
\ No newline at end of file
diff --git a/tool/lemon.c b/tool/lemon.c
index 97e5fab440..315719c021 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -4389,6 +4389,10 @@ void ReportTable(
}
lineno = 1;
+ fprintf(out,
+ "/* This file is automatically generated by Lemon from input grammar\n"
+ "** source file \"%s\". */\n", lemp->filename); lineno += 2;
+
/* The first %include directive begins with a C-language comment,
** then skip over the header comment of the template file
*/
From 52cfe0312a3e26267635d7bc06f145e62e9183ce Mon Sep 17 00:00:00 2001
From: mistachkin
Date: Tue, 1 Sep 2020 19:02:52 +0000
Subject: [PATCH 049/169] Fix harmless compiler warning.
FossilOrigin-Name: a711e8cd2c7b64e06241736ecef478ac64ddbe7b58e0933b6febba63f7fb06e1
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
tool/lemon.c | 1 -
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index c80c5cffe6..f182d2fd6a 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\sLemon\soutput,\sadd\sa\sprefix\scomment\sthat\sexplains\sthat\sthe\soutput\sfile\nis\sautomatically\sgenerated\sand\sshows\sthe\sname\sof\sthe\ssource\sfile.
-D 2020-09-01T12:26:55.781
+C Fix\sharmless\scompiler\swarning.
+D 2020-09-01T19:02:52.344
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1798,7 +1798,7 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c 01eff5008ba46e98f4b954317bfe57ea29b836e6d3e72e1bbdaad4ca3db501b3
+F tool/lemon.c 992ef3a155c83fed9b49092af355b7f7d8cb426b2f9d32a30f602b8da50b00f6
F tool/lempar.c dc1f5e8a0847c2257b0b069c61e290227062c4d75f5b5a0797b75b08b1c00405
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
@@ -1879,7 +1879,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 84d54eb35716174195ee7e5ac846f47308e5dbb0056e8ff568daa133860bab74
-R 7f45e5b59f1c52d29dee23ebb0c2337a
-U drh
-Z 0e6fd8fbc683d31bd259b25e22ecc736
+P d34caf3bb63d0512ea116a8c8c8343b76aa39441bd4b3e98231747a705b91d54
+R 3b0720b948ac82f32202ffcf9870e5f6
+U mistachkin
+Z 3e6d19f97d4c9ecb153999370e83af0d
diff --git a/manifest.uuid b/manifest.uuid
index 12efad1e94..7dac36df40 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-d34caf3bb63d0512ea116a8c8c8343b76aa39441bd4b3e98231747a705b91d54
\ No newline at end of file
+a711e8cd2c7b64e06241736ecef478ac64ddbe7b58e0933b6febba63f7fb06e1
\ No newline at end of file
diff --git a/tool/lemon.c b/tool/lemon.c
index 315719c021..59b0fcbe42 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -4422,7 +4422,6 @@ void ReportTable(
if( lemp->tokenprefix ) prefix = lemp->tokenprefix;
else prefix = "";
if( mhflag ){
- const char *prefix;
fprintf(out,"#if INTERFACE\n"); lineno++;
}else{
fprintf(out,"#ifndef %s%s\n", prefix, lemp->symbols[1]->name);
From 2b06b0769ed38e408b4d28406db44cda44bdbbcd Mon Sep 17 00:00:00 2001
From: dan
Date: Fri, 4 Sep 2020 17:30:59 +0000
Subject: [PATCH 050/169] Ensure that the busy-handler count is reset at the
end of each sqlite3_file_control() and sqlite3_prepare() (and _v2() and
_v3()).
FossilOrigin-Name: 5dd05940617fb05ee2faf212b15afc3a8e9695318eccb76761b37359fea681d1
---
manifest | 20 ++++++++++----------
manifest.uuid | 2 +-
src/main.c | 2 ++
src/os_unix.c | 1 +
src/prepare.c | 1 +
test/busy2.test | 36 ++++++++++++++++++++++++++++++++++++
6 files changed, 51 insertions(+), 11 deletions(-)
diff --git a/manifest b/manifest
index f182d2fd6a..a696680dfb 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sharmless\scompiler\swarning.
-D 2020-09-01T19:02:52.344
+C Ensure\sthat\sthe\sbusy-handler\scount\sis\sreset\sat\sthe\send\sof\seach\ssqlite3_file_control()\sand\ssqlite3_prepare()\s(and\s_v2()\sand\s_v3()).
+D 2020-09-04T17:30:59.717
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -499,7 +499,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 7e081d33aab4a9d761c39dccf3c3872c35501565d2ed9db66301918d23bc7901
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 436af4968c6954d304fce9efa12719367bd8f37b19b93b71d6ad607e85adbb47
-F src/main.c 1b7b95b6168e29c8235042b0b7102ecbb9e6765bbc82b74f2b96294b230f60f3
+F src/main.c 54d61d1e94f225636053c862c930d7dd7b29162b93d3f3ecb00439910ccba02a
F src/malloc.c 22d5bdd9fe88ae4fad1b91a1b9735104b82853ffef868f1f05517d60dc1875f5
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@@ -519,7 +519,7 @@ F src/os.c 80e4cf3e5da06be03ca641661e331ce60eeeeabf0d7354dbb1c0e166d0eedbbe
F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c d707ed2867a2fb32101469327acf3274165d9935e9ab9e27bdab0c1a7d661be7
+F src/os_unix.c 99a6ace048b97b0fa6cab3b9216b9e65c3f876095f2adb5adbce41fa1664bc92
F src/os_win.c a2149ff0a85c1c3f9cc102a46c673ce87e992396ba3411bfb53db66813b32f1d
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
@@ -530,7 +530,7 @@ F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
F src/pragma.c 5435b9fe17f7728bd460f52d6d9388e7e45658c6f5549f28fc2d408be9efd2d5
F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
-F src/prepare.c 38ae9c2e3550bfa496886a862a5344c420ded052fd92294f409a07a53f372ffe
+F src/prepare.c 270170a239c0f66bd3c228f373afe24447c2614a6829ae22080babc64f241931
F src/printf.c 30e92b638fac71dcd85cdea1d12ecfae354c9adee2c71e8e1ae4727cde7c91ed
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
@@ -728,7 +728,7 @@ F test/btree01.test e08b3613540145b353f20c81cb18ead54ff12e0f
F test/btree02.test 7555a5440453d900410160a52554fe6478af4faf53098f7235f1f443d5a1d6cc
F test/btreefault.test c2bcb542685eea44621275cfedbd8a13f65201e3
F test/busy.test 510dc6daaad18bcbbc085bcc6217d6dc418def5e73f72ce1475eea0cb7834727
-F test/busy2.test 2499cb62c9e58e18335892602c158cb35639c411803adca6423401b31e46c503
+F test/busy2.test 26ae3b8b74235c851f27326807de94292af4d359476c629f80dc106f35c8293e
F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
F test/cacheflush.test af25bb1509df04c1da10e38d8f322d66eceedf61
F test/cachespill.test 895997f84a25b323b166aecb69baab2d6380ea98f9e0bcc688c4493c535cfab9
@@ -1879,7 +1879,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 d34caf3bb63d0512ea116a8c8c8343b76aa39441bd4b3e98231747a705b91d54
-R 3b0720b948ac82f32202ffcf9870e5f6
-U mistachkin
-Z 3e6d19f97d4c9ecb153999370e83af0d
+P a711e8cd2c7b64e06241736ecef478ac64ddbe7b58e0933b6febba63f7fb06e1
+R 26f4f81a99efb7f9a6941c96218c958a
+U dan
+Z c330f4f258e7e0fb9ad4c93d21a78b2b
diff --git a/manifest.uuid b/manifest.uuid
index 7dac36df40..bdab94c631 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-a711e8cd2c7b64e06241736ecef478ac64ddbe7b58e0933b6febba63f7fb06e1
\ No newline at end of file
+5dd05940617fb05ee2faf212b15afc3a8e9695318eccb76761b37359fea681d1
\ No newline at end of file
diff --git a/src/main.c b/src/main.c
index 2cc092e92a..cc1464f136 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3852,7 +3852,9 @@ int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
}
rc = SQLITE_OK;
}else{
+ int nSave = db->busyHandler.nBusy;
rc = sqlite3OsFileControl(fd, op, pArg);
+ db->busyHandler.nBusy = nSave;
}
sqlite3BtreeLeave(pBtree);
}
diff --git a/src/os_unix.c b/src/os_unix.c
index 5419a042a6..ac5c33e82f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2145,6 +2145,7 @@ static int unixClose(sqlite3_file *id){
}
sqlite3_mutex_leave(pInode->pLockMutex);
releaseInodeInfo(pFile);
+ assert( pFile->pShm==0 );
rc = closeUnixFile(id);
unixLeaveMutex();
return rc;
diff --git a/src/prepare.c b/src/prepare.c
index dac12d8a5b..13fd1d33b2 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -746,6 +746,7 @@ static int sqlite3LockAndPrepare(
sqlite3BtreeLeaveAll(db);
rc = sqlite3ApiExit(db, rc);
assert( (rc&db->errMask)==rc );
+ db->busyHandler.nBusy = 0;
sqlite3_mutex_leave(db->mutex);
return rc;
}
diff --git a/test/busy2.test b/test/busy2.test
index fb9ef2301d..8989542fda 100644
--- a/test/busy2.test
+++ b/test/busy2.test
@@ -131,5 +131,41 @@ do_multiclient_test tn {
}
}
+#-------------------------------------------------------------------------
+# Check that even if the busy-handler fails (returns zero) within a
+# call to sqlite3_prepare() (or _v2(), or _v3()), it is still invoked
+# the next time an SQLITE_BUSY is encountered.
+#
+
+do_multiclient_test tn {
+ code1 {
+ set ::busy_called 0
+ proc busy {args} {
+ if {$::busy_called} { return 1 }
+ set ::busy_called 1
+ return 0
+ }
+ db busy busy
+ }
+
+ do_test 3.$tn.1 {
+ sql2 {
+ CREATE TABLE t1(x);
+ BEGIN EXCLUSIVE;
+ INSERT INTO t1 VALUES('x');
+ }
+ } {}
+
+ do_test 3.$tn.2 {
+ set ::busy_called 0
+ list [catch { sql1 { SELECT * FROM t1 } } msg] $msg $::busy_called
+ } {1 {database is locked} 1}
+
+ do_test 3.$tn.3 {
+ set ::busy_called 0
+ list [catch { sql1 { SELECT * FROM t1 } } msg] $msg $::busy_called
+ } {1 {database is locked} 1}
+}
+
finish_test
From 78f04753ae133a41a705c889bc13479332c17856 Mon Sep 17 00:00:00 2001
From: dan
Date: Fri, 4 Sep 2020 19:10:43 +0000
Subject: [PATCH 051/169] Fix a tsan error that could occur when using
shared-cache mode.
FossilOrigin-Name: de80bc87300257cc49d98e2d22e914211f213dce912f320c8b37b3883c73923c
---
manifest | 15 +++++++------
manifest.uuid | 2 +-
src/btree.c | 2 +-
test/threadtest3.c | 2 ++
test/tt3_shared.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 67 insertions(+), 9 deletions(-)
create mode 100644 test/tt3_shared.c
diff --git a/manifest b/manifest
index a696680dfb..5498925793 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Ensure\sthat\sthe\sbusy-handler\scount\sis\sreset\sat\sthe\send\sof\seach\ssqlite3_file_control()\sand\ssqlite3_prepare()\s(and\s_v2()\sand\s_v3()).
-D 2020-09-04T17:30:59.717
+C Fix\sa\stsan\serror\sthat\scould\soccur\swhen\susing\sshared-cache\smode.
+D 2020-09-04T19:10:43.046
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -476,7 +476,7 @@ F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06
F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
-F src/btree.c 87f2c3f1812b49fbb700fefc4852216af2904016b42b22c2cd5b9c254cc6665a
+F src/btree.c 1fbb15cf6af2ccd4bc784f52bda7e6a860e303d677587b6a4b95d72ae36480a0
F src/btree.h c64f1439377e2edf31f7c3a562586a96b71f8d0ca47e65756e7d122fd8f06928
F src/btreeInt.h ffd66480520d9d70222171b3a026d78b80833b5cea49c89867949f3e023d5f43
F src/build.c 92b61c2be1e35a619391f17c2d1b108901ad5e4df99becc0b064a934e6ec662a
@@ -1437,7 +1437,7 @@ F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46
F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c a70a8e94bef23339d34226eb9521015ef99f4df8
-F test/threadtest3.c 38a612ea62854349ed66372f330a40d73c5cf956
+F test/threadtest3.c e63013af10cf236c7610eb06d33bde08c861806dc64be811940ff4d9ddd34a4f
F test/threadtest4.c c1e67136ceb6c7ec8184e56ac61db28f96bd2925
F test/time-wordcount.sh 8e0b0f8109367827ad5d58f5cc849705731e4b90
F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c
@@ -1613,6 +1613,7 @@ F test/trustschema1.test 4e970aef0bfe0cee139703cc7209d0e0f07725d999b180ba50770f4
F test/tt3_checkpoint.c 9e75cf7c1c364f52e1c47fd0f14c4340a9db0fe1
F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a
F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9
+F test/tt3_shared.c b37d22defc944a2ac4c91c927fd06c1d48cd51e2ce9d004fe868625bd2399f93
F test/tt3_stress.c f9a769ca8b026ecc76ee93ca8c9700a5619f8e51c581107c4053ba6ac97f616f
F test/tt3_vacuum.c 1753f45917699c9c1f66b64c717a717c9379f776
F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff
@@ -1879,7 +1880,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 a711e8cd2c7b64e06241736ecef478ac64ddbe7b58e0933b6febba63f7fb06e1
-R 26f4f81a99efb7f9a6941c96218c958a
+P 5dd05940617fb05ee2faf212b15afc3a8e9695318eccb76761b37359fea681d1
+R 0274cf48514643c9c3f213a9959e5172
U dan
-Z c330f4f258e7e0fb9ad4c93d21a78b2b
+Z c8e0642635bfc4eca0e83411ec752c32
diff --git a/manifest.uuid b/manifest.uuid
index bdab94c631..d93272820f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5dd05940617fb05ee2faf212b15afc3a8e9695318eccb76761b37359fea681d1
\ No newline at end of file
+de80bc87300257cc49d98e2d22e914211f213dce912f320c8b37b3883c73923c
\ No newline at end of file
diff --git a/src/btree.c b/src/btree.c
index ff05c77264..7f1a15198b 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -2616,7 +2616,7 @@ btree_open_out:
** do not change the pager-cache size.
*/
if( sqlite3BtreeSchema(p, 0, 0)==0 ){
- sqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE);
+ sqlite3BtreeSetCacheSize(p, SQLITE_DEFAULT_CACHE_SIZE);
}
pFile = sqlite3PagerFile(pBt->pPager);
diff --git a/test/threadtest3.c b/test/threadtest3.c
index 6062b64285..41c0fb9ac6 100644
--- a/test/threadtest3.c
+++ b/test/threadtest3.c
@@ -1433,6 +1433,7 @@ static void dynamic_triggers(int nMs){
#include "tt3_lookaside1.c"
#include "tt3_vacuum.c"
#include "tt3_stress.c"
+#include "tt3_shared.c"
int main(int argc, char **argv){
struct ThreadTest {
@@ -1457,6 +1458,7 @@ int main(int argc, char **argv){
{ vacuum1, "vacuum1", 10000 },
{ stress1, "stress1", 10000 },
{ stress2, "stress2", 60000 },
+ { shared1, "shared1", 10000 },
};
static char *substArgv[] = { 0, "*", 0 };
int i, iArg;
diff --git a/test/tt3_shared.c b/test/tt3_shared.c
new file mode 100644
index 0000000000..5bdadd1e03
--- /dev/null
+++ b/test/tt3_shared.c
@@ -0,0 +1,55 @@
+/*
+** 2020 September 5
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+**
+*/
+
+
+/*
+*/
+static char *shared_thread1(int iTid, void *pArg){
+ Error err = {0}; /* Error code and message */
+
+ while( !timetostop(&err) ){
+ Sqlite db = {0}; /* SQLite database connection */
+ opendb(&err, &db, "test.db", 0);
+ sql_script(&err, &db, "SELECT * FROM t1");
+ closedb(&err, &db);
+ }
+ print_and_free_err(&err);
+ return sqlite3_mprintf("done!");
+}
+
+
+static void shared1(int nMs){
+ Error err = {0};
+ Sqlite db = {0}; /* SQLite database connection */
+ Threadset threads = {0};
+ int ii;
+
+ opendb(&err, &db, "test.db", 1);
+ sql_script(&err, &db, "CREATE TABLE t1(x)");
+ closedb(&err, &db);
+
+ setstoptime(&err, nMs);
+ sqlite3_enable_shared_cache(1);
+
+ for(ii=0; ii<5; ii++){
+ launch_thread(&err, &threads, shared_thread1, 0);
+ }
+
+ join_all_threads(&err, &threads);
+ sqlite3_enable_shared_cache(0);
+
+ print_and_free_err(&err);
+}
+
From 2b75d3beb0b38069e15faf58e7b28cd273cc273e Mon Sep 17 00:00:00 2001
From: drh
Date: Sat, 5 Sep 2020 06:21:54 +0000
Subject: [PATCH 052/169] Fix a bug in Fossil that might cause it to crash if
there is a multi-terminal token with a space following the "|" separator.
This does not affect SQLite.
FossilOrigin-Name: 430c5d1da57af452f236cc862139d84ab97b6020f6d327dae5268c58e6e83a87
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
tool/lemon.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index 5498925793..711a650d62 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\stsan\serror\sthat\scould\soccur\swhen\susing\sshared-cache\smode.
-D 2020-09-04T19:10:43.046
+C Fix\sa\sbug\sin\sFossil\sthat\smight\scause\sit\sto\scrash\sif\sthere\sis\na\smulti-terminal\stoken\swith\sa\sspace\sfollowing\sthe\s"|"\sseparator.\nThis\sdoes\snot\saffect\sSQLite.
+D 2020-09-05T06:21:54.289
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1799,7 +1799,7 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c 992ef3a155c83fed9b49092af355b7f7d8cb426b2f9d32a30f602b8da50b00f6
+F tool/lemon.c 68f547dabafdaedafe2e253651122de33340486c169ae67087ab0eb4fbc8a646
F tool/lempar.c dc1f5e8a0847c2257b0b069c61e290227062c4d75f5b5a0797b75b08b1c00405
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
@@ -1880,7 +1880,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 5dd05940617fb05ee2faf212b15afc3a8e9695318eccb76761b37359fea681d1
-R 0274cf48514643c9c3f213a9959e5172
-U dan
-Z c8e0642635bfc4eca0e83411ec752c32
+P de80bc87300257cc49d98e2d22e914211f213dce912f320c8b37b3883c73923c
+R facb72b5cc955d8ca9224dab23a822fa
+U drh
+Z 3d5047b2637f17549cccb477c1c6f3d6
diff --git a/manifest.uuid b/manifest.uuid
index d93272820f..e956a6fd8a 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-de80bc87300257cc49d98e2d22e914211f213dce912f320c8b37b3883c73923c
\ No newline at end of file
+430c5d1da57af452f236cc862139d84ab97b6020f6d327dae5268c58e6e83a87
\ No newline at end of file
diff --git a/tool/lemon.c b/tool/lemon.c
index 59b0fcbe42..a18f0a2629 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -2426,7 +2426,7 @@ static void parseonetoken(struct pstate *psp)
psp->alias[psp->nrhs] = 0;
psp->nrhs++;
}
- }else if( (x[0]=='|' || x[0]=='/') && psp->nrhs>0 ){
+ }else if( (x[0]=='|' || x[0]=='/') && psp->nrhs>0 && ISUPPER(x[1]) ){
struct symbol *msp = psp->rhs[psp->nrhs-1];
if( msp->type!=MULTITERMINAL ){
struct symbol *origsp = msp;
From 8ab0809473ea0c4738594fcbb3e0a07244d3bd0b Mon Sep 17 00:00:00 2001
From: drh
Date: Sun, 6 Sep 2020 17:40:38 +0000
Subject: [PATCH 053/169] Remove an artifical limitation on the length of
columns in the "box" output mode of the command-line shell.
FossilOrigin-Name: 783fa887c9ed1a7d72c310df1dd9de91c016061b05fdeec87fbb2a7eb0b952ea
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/shell.c.in | 2 --
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index 711a650d62..5409044ca6 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sbug\sin\sFossil\sthat\smight\scause\sit\sto\scrash\sif\sthere\sis\na\smulti-terminal\stoken\swith\sa\sspace\sfollowing\sthe\s"|"\sseparator.\nThis\sdoes\snot\saffect\sSQLite.
-D 2020-09-05T06:21:54.289
+C Remove\san\sartifical\slimitation\son\sthe\slength\sof\scolumns\sin\sthe\s"box"\noutput\smode\sof\sthe\scommand-line\sshell.
+D 2020-09-06T17:40:38.994
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -536,7 +536,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
-F src/shell.c.in 9bae0c8397e7b592fb404678c4c1fc7944d9dc798a928d1eb40bcd608c33d21b
+F src/shell.c.in a53743f2f44c59675baa9d7b2e1398e80b2913c752686a40d9c172372368113b
F src/sqlite.h.in 473a79ff2c5c6d54a09af88206ea4d02c4b74558f7d29315a4ede05da8eb8732
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1880,7 +1880,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 de80bc87300257cc49d98e2d22e914211f213dce912f320c8b37b3883c73923c
-R facb72b5cc955d8ca9224dab23a822fa
+P 430c5d1da57af452f236cc862139d84ab97b6020f6d327dae5268c58e6e83a87
+R 038528dd5dd276621573688d022a2cdf
U drh
-Z 3d5047b2637f17549cccb477c1c6f3d6
+Z b1d1b246b08e17091c7e8f5a7125e2a2
diff --git a/manifest.uuid b/manifest.uuid
index e956a6fd8a..9cff4af95d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-430c5d1da57af452f236cc862139d84ab97b6020f6d327dae5268c58e6e83a87
\ No newline at end of file
+783fa887c9ed1a7d72c310df1dd9de91c016061b05fdeec87fbb2a7eb0b952ea
\ No newline at end of file
diff --git a/src/shell.c.in b/src/shell.c.in
index dcaff91614..9a829bb8c8 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -553,8 +553,6 @@ static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
int i;
int n;
int aw = w<0 ? -w : w;
- char zBuf[1000];
- if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3;
for(i=n=0; zUtf[i]; i++){
if( (zUtf[i]&0xc0)!=0x80 ){
n++;
From ebd2ecdda7c13e92a01349bf9b58367975b3f264 Mon Sep 17 00:00:00 2001
From: dan
Date: Mon, 7 Sep 2020 11:14:27 +0000
Subject: [PATCH 054/169] Fix another (harmless in practice) tsan error in
shared-cache mode.
FossilOrigin-Name: 5a74fa3f0a64f462c8add9beae231a9bbdd19e54d07b54f08726cb1411fc8d3a
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/vdbesort.c | 5 ++++-
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index 5409044ca6..d0d627d2c8 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\san\sartifical\slimitation\son\sthe\slength\sof\scolumns\sin\sthe\s"box"\noutput\smode\sof\sthe\scommand-line\sshell.
-D 2020-09-06T17:40:38.994
+C Fix\sanother\s(harmless\sin\spractice)\stsan\serror\sin\sshared-cache\smode.
+D 2020-09-07T11:14:27.389
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -614,7 +614,7 @@ F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
F src/vdbeaux.c b39d2e0e7126cd4629874dd7b67162b9f0d200b620d2b4c16d400949a2f1094b
F src/vdbeblob.c 253ed82894924c362a7fa3079551d3554cd1cdace39aa833da77d3bc67e7c1b1
F src/vdbemem.c 947f2a65910edb4014dc981d33e414a68c51f169f9df8c4c493a0ba840b6eb1f
-F src/vdbesort.c 2be76d26998ce2b3324cdcc9f6443728e54b6c7677c553ad909c7d7cfab587df
+F src/vdbesort.c f5b5e473a7cee44e47a94817b042fd7172cf3aa2c0a7928a8339d612bcfdec5a
F src/vdbetrace.c fa3bf238002f0bbbdfb66cc8afb0cea284ff9f148d6439bc1f6f2b4c3b7143f0
F src/vdbevtab.c f99b275366c5fc5e2d99f734729880994ab9500bdafde7fae3b02d562b9d323c
F src/vtab.c 5f5fc793092f53bbdfde296c50f563fb7bda58cf48e9cf6a8bdfbc5abd409845
@@ -1880,7 +1880,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 430c5d1da57af452f236cc862139d84ab97b6020f6d327dae5268c58e6e83a87
-R 038528dd5dd276621573688d022a2cdf
-U drh
-Z b1d1b246b08e17091c7e8f5a7125e2a2
+P 783fa887c9ed1a7d72c310df1dd9de91c016061b05fdeec87fbb2a7eb0b952ea
+R 7ac49ea27f18cc1fbf6aa814b25b07be
+U dan
+Z d2eda3ed87ec86c73c6a2c785f68a36a
diff --git a/manifest.uuid b/manifest.uuid
index 9cff4af95d..ce509b6935 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-783fa887c9ed1a7d72c310df1dd9de91c016061b05fdeec87fbb2a7eb0b952ea
\ No newline at end of file
+5a74fa3f0a64f462c8add9beae231a9bbdd19e54d07b54f08726cb1411fc8d3a
\ No newline at end of file
diff --git a/src/vdbesort.c b/src/vdbesort.c
index 777c2054e8..f61b8b7320 100644
--- a/src/vdbesort.c
+++ b/src/vdbesort.c
@@ -970,13 +970,16 @@ int sqlite3VdbeSorterInit(
if( pSorter==0 ){
rc = SQLITE_NOMEM_BKPT;
}else{
+ Btree *pBt = db->aDb[0].pBt;
pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);
memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
pKeyInfo->db = 0;
if( nField && nWorker==0 ){
pKeyInfo->nKeyField = nField;
}
- pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
+ sqlite3BtreeEnter(pBt);
+ pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(pBt);
+ sqlite3BtreeLeave(pBt);
pSorter->nTask = nWorker + 1;
pSorter->iPrev = (u8)(nWorker - 1);
pSorter->bUseThreads = (pSorter->nTask>1);
From 786142a994c1bd35e62e2b9621b035716943719d Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 10 Sep 2020 12:41:46 +0000
Subject: [PATCH 055/169] If an amalgamation is created using
SQLITE_ENABLE_UPDATE_DELETE_LIMIT, ensure that it can still be compiled
without that option by setting the SQLITE_UDL_CAPABLE_PARSER flag in the
preamble.
FossilOrigin-Name: 5b905d7d7714d1d2c433ff58f5d6917d6d27302d44ca347aa740e768f1354b16
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
tool/mksqlite3c.tcl | 12 ++++++++++++
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index d0d627d2c8..078d0f4af5 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sanother\s(harmless\sin\spractice)\stsan\serror\sin\sshared-cache\smode.
-D 2020-09-07T11:14:27.389
+C If\san\samalgamation\sis\screated\susing\sSQLITE_ENABLE_UPDATE_DELETE_LIMIT,\nensure\sthat\sit\scan\sstill\sbe\scompiled\swithout\sthat\soption\sby\ssetting\sthe\nSQLITE_UDL_CAPABLE_PARSER\sflag\sin\sthe\spreamble.
+D 2020-09-10T12:41:46.886
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1818,7 +1818,7 @@ F tool/mkshellc.tcl 70a9978e363b0f3280ca9ce1c46d72563ff479c1930a12a7375e3881b732
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
-F tool/mksqlite3c.tcl f4ef476510eca4124c874a72029f1e01bc54a896b1724e8f9eef0d8bfae0e84c
+F tool/mksqlite3c.tcl 00c4c0382eb000153182da2bee2547ca05554eeeed10177efe5894c54e4e6d4d
F tool/mksqlite3h.tcl 1f5e4a1dbbbc43c83cc6e74fe32c6c620502240b66c7c0f33a51378e78fc4edf
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
F tool/mkvsix.tcl b9e0777a213c23156b6542842c238479e496ebf5
@@ -1880,7 +1880,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 783fa887c9ed1a7d72c310df1dd9de91c016061b05fdeec87fbb2a7eb0b952ea
-R 7ac49ea27f18cc1fbf6aa814b25b07be
-U dan
-Z d2eda3ed87ec86c73c6a2c785f68a36a
+P 5a74fa3f0a64f462c8add9beae231a9bbdd19e54d07b54f08726cb1411fc8d3a
+R f2994ae8785f87ea558c8aaa5e215f74
+U drh
+Z dbf3dc39a96afb8f8baf72c142163fc9
diff --git a/manifest.uuid b/manifest.uuid
index ce509b6935..7285701da2 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5a74fa3f0a64f462c8add9beae231a9bbdd19e54d07b54f08726cb1411fc8d3a
\ No newline at end of file
+5b905d7d7714d1d2c433ff58f5d6917d6d27302d44ca347aa740e768f1354b16
\ No newline at end of file
diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl
index 36663ff3b1..41cf8aa95c 100644
--- a/tool/mksqlite3c.tcl
+++ b/tool/mksqlite3c.tcl
@@ -88,6 +88,18 @@ if {$addstatic} {
#endif}
}
+# Examine the parse.c file. If it contains lines of the form:
+#
+# "#ifndef SQLITE_ENABLE_UPDATE_LIMIT
+#
+# then set the SQLITE_UDL_CAPABLE_PARSER flag in the amalgamation.
+#
+set in [open tsrc/parse.c]
+if {[regexp {ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT} [read $in]]} {
+ puts $out "#define SQLITE_UDL_CAPABLE_PARSER 1"
+}
+close $in
+
# These are the header files used by SQLite. The first time any of these
# files are seen in a #include statement in the C code, include the complete
# text of the file in-line. The file only needs to be included once.
From 4fb8452875d6053fa55bbe18c0fcea8c13ba4f31 Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 10 Sep 2020 14:54:57 +0000
Subject: [PATCH 056/169] Fix typo in the documentation for the new
sqlite3_txn_state() interface.
FossilOrigin-Name: 23f7d01758cbcf22bd34e78fb8284c7af18f3059a03c4ff6ab3e556ca11fce19
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/sqlite.h.in | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 078d0f4af5..940bfcd0af 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C If\san\samalgamation\sis\screated\susing\sSQLITE_ENABLE_UPDATE_DELETE_LIMIT,\nensure\sthat\sit\scan\sstill\sbe\scompiled\swithout\sthat\soption\sby\ssetting\sthe\nSQLITE_UDL_CAPABLE_PARSER\sflag\sin\sthe\spreamble.
-D 2020-09-10T12:41:46.886
+C Fix\stypo\sin\sthe\sdocumentation\sfor\sthe\snew\ssqlite3_txn_state()\sinterface.
+D 2020-09-10T14:54:57.421
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -537,7 +537,7 @@ F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
F src/shell.c.in a53743f2f44c59675baa9d7b2e1398e80b2913c752686a40d9c172372368113b
-F src/sqlite.h.in 473a79ff2c5c6d54a09af88206ea4d02c4b74558f7d29315a4ede05da8eb8732
+F src/sqlite.h.in e48a9ead2c92cc9bcd9777cacde9d2d4fa064b890a455c71b9b1fcbf217b8c58
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
F src/sqliteInt.h d8d69318b1ba3906d4860da1cd1c6b3650b81c9595e5bc360c6469a1e54e09e1
@@ -1880,7 +1880,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 5a74fa3f0a64f462c8add9beae231a9bbdd19e54d07b54f08726cb1411fc8d3a
-R f2994ae8785f87ea558c8aaa5e215f74
+P 5b905d7d7714d1d2c433ff58f5d6917d6d27302d44ca347aa740e768f1354b16
+R be64fff301bb00c2dcae78de007bf313
U drh
-Z dbf3dc39a96afb8f8baf72c142163fc9
+Z ed78d5b4e1f970ffc402f8a37f0569c1
diff --git a/manifest.uuid b/manifest.uuid
index 7285701da2..0a95e57595 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5b905d7d7714d1d2c433ff58f5d6917d6d27302d44ca347aa740e768f1354b16
\ No newline at end of file
+23f7d01758cbcf22bd34e78fb8284c7af18f3059a03c4ff6ab3e556ca11fce19
\ No newline at end of file
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 2a8ad56ce9..335b188505 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -6199,7 +6199,7 @@ int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
** SQLITE_TXN_READ
** SQLITE_TXN_WRITE
**
-** ^If the S argument to sqlite3_txn_state(D,S) is in the name of
+** ^If the S argument to sqlite3_txn_state(D,S) is not in the name of
** a valid schema, then -1 is returned.
*/
int sqlite3_txn_state(sqlite3*,const char *zSchema);
From 94acc2ef42e3e908dd0afb9ae2309a7236f4ecff Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 10 Sep 2020 15:09:11 +0000
Subject: [PATCH 057/169] Try again to fix the typo in the sqlite3_txn_state()
documentation.
FossilOrigin-Name: 6d1ab0403c2855b595f5d294305f41f56a7a93503f2a58d1b1d12431d480704e
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/sqlite.h.in | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 940bfcd0af..2d094ed03a 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\stypo\sin\sthe\sdocumentation\sfor\sthe\snew\ssqlite3_txn_state()\sinterface.
-D 2020-09-10T14:54:57.421
+C Try\sagain\sto\sfix\sthe\stypo\sin\sthe\ssqlite3_txn_state()\sdocumentation.
+D 2020-09-10T15:09:11.613
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -537,7 +537,7 @@ F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
F src/shell.c.in a53743f2f44c59675baa9d7b2e1398e80b2913c752686a40d9c172372368113b
-F src/sqlite.h.in e48a9ead2c92cc9bcd9777cacde9d2d4fa064b890a455c71b9b1fcbf217b8c58
+F src/sqlite.h.in 11896ccb28f85b0aa52f0d4169aaca0ed7cf3f9b3e0c544aecee0032ae2b3c2e
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
F src/sqliteInt.h d8d69318b1ba3906d4860da1cd1c6b3650b81c9595e5bc360c6469a1e54e09e1
@@ -1880,7 +1880,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 5b905d7d7714d1d2c433ff58f5d6917d6d27302d44ca347aa740e768f1354b16
-R be64fff301bb00c2dcae78de007bf313
+P 23f7d01758cbcf22bd34e78fb8284c7af18f3059a03c4ff6ab3e556ca11fce19
+R ea5549217c8e8fbad65a7e34d8502e26
U drh
-Z ed78d5b4e1f970ffc402f8a37f0569c1
+Z a0388bd7f98f862d9d5f5978cc68a2fa
diff --git a/manifest.uuid b/manifest.uuid
index 0a95e57595..ff699a6350 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-23f7d01758cbcf22bd34e78fb8284c7af18f3059a03c4ff6ab3e556ca11fce19
\ No newline at end of file
+6d1ab0403c2855b595f5d294305f41f56a7a93503f2a58d1b1d12431d480704e
\ No newline at end of file
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 335b188505..be940e0197 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -6199,7 +6199,7 @@ int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
** SQLITE_TXN_READ
** SQLITE_TXN_WRITE
**
-** ^If the S argument to sqlite3_txn_state(D,S) is not in the name of
+** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
** a valid schema, then -1 is returned.
*/
int sqlite3_txn_state(sqlite3*,const char *zSchema);
From 86f477edaa17767b39c7bae5b67cac8580f7a8c1 Mon Sep 17 00:00:00 2001
From: dan
Date: Fri, 11 Sep 2020 15:01:49 +0000
Subject: [PATCH 058/169] Catch fts5 index corruption caused by issuing
'delete' commands with incorrect data earlier in some cases. Also fix a
couple of test script problems.
FossilOrigin-Name: b79f19edfd33c2a75f936c352668e14e81f35acf4f07edc27a21f941a7304b38
---
ext/fts5/fts5_expr.c | 4 ++-
ext/fts5/fts5_storage.c | 9 ++++++-
ext/fts5/test/fts5corrupt3.test | 2 +-
ext/fts5/test/fts5delete.test | 43 +++++++++++++++++++++++++++++++++
manifest | 20 +++++++--------
manifest.uuid | 2 +-
6 files changed, 66 insertions(+), 14 deletions(-)
diff --git a/ext/fts5/fts5_expr.c b/ext/fts5/fts5_expr.c
index 01be61da35..40d15ec170 100644
--- a/ext/fts5/fts5_expr.c
+++ b/ext/fts5/fts5_expr.c
@@ -2409,7 +2409,9 @@ static char *fts5ExprPrint(Fts5Config *pConfig, Fts5ExprNode *pExpr){
pConfig->azCol[pColset->aiCol[ii]], ii==pColset->nCol-1 ? "" : " "
);
}
- zRet = fts5PrintfAppend(zRet, "%s : ", pColset->nCol>1 ? "}" : "");
+ if( zRet ){
+ zRet = fts5PrintfAppend(zRet, "%s : ", pColset->nCol>1 ? "}" : "");
+ }
if( zRet==0 ) return 0;
}
diff --git a/ext/fts5/fts5_storage.c b/ext/fts5/fts5_storage.c
index 22f90c0ef8..a33bbf6012 100644
--- a/ext/fts5/fts5_storage.c
+++ b/ext/fts5/fts5_storage.c
@@ -429,9 +429,16 @@ static int fts5StorageDeleteFromIndex(
zText, nText, (void*)&ctx, fts5StorageInsertCallback
);
p->aTotalSize[iCol-1] -= (i64)ctx.szCol;
+ if( p->aTotalSize[iCol-1]<0 ){
+ rc = FTS5_CORRUPT;
+ }
}
}
- p->nTotalRow--;
+ if( rc==SQLITE_OK && p->nTotalRow<1 ){
+ rc = FTS5_CORRUPT;
+ }else{
+ p->nTotalRow--;
+ }
rc2 = sqlite3_reset(pSeek);
if( rc==SQLITE_OK ) rc = rc2;
diff --git a/ext/fts5/test/fts5corrupt3.test b/ext/fts5/test/fts5corrupt3.test
index 25aa094e97..8b3e6c8dc3 100644
--- a/ext/fts5/test/fts5corrupt3.test
+++ b/ext/fts5/test/fts5corrupt3.test
@@ -9691,7 +9691,7 @@ do_test 65.0 {
do_catchsql_test 65.1 {
SELECT ( MATCH (t1,591)) FROM t1 WHERE t1 MATCH 'e*eŸ'
-} {1 {database disk image is malformed}}
+} {1 {malformed database schema (t2) - invalid rootpage}}
#-------------------------------------------------------------------------
#
diff --git a/ext/fts5/test/fts5delete.test b/ext/fts5/test/fts5delete.test
index 488ce02f1b..467e2e5707 100644
--- a/ext/fts5/test/fts5delete.test
+++ b/ext/fts5/test/fts5delete.test
@@ -50,4 +50,47 @@ do_test 1.2 {
}
} {}
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 2.0 {
+ CREATE TABLE test (
+ id INTEGER PRIMARY KEY,
+ name TEXT,
+ value TEXT
+ );
+ CREATE VIRTUAL TABLE test_idx USING fts5(
+ name, content=test, content_rowid=id
+ );
+}
+
+do_catchsql_test 2.1 {
+ INSERT INTO test_idx (test_idx, rowid, name) VALUES('delete', 1, 'quick');
+} {1 {database disk image is malformed}}
+
+do_catchsql_test 2.2 {
+ INSERT INTO test_idx(rowid, name) VALUES(123, 'one one one');
+ INSERT INTO test_idx (test_idx, rowid, name) VALUES('delete', 123, 'one');
+ INSERT INTO test_idx (test_idx, rowid, name) VALUES('delete', 123, 'one');
+} {1 {database disk image is malformed}}
+
+do_execsql_test 2.3 {
+ DROP TABLE test_idx;
+ CREATE VIRTUAL TABLE test_idx USING fts5(
+ name, content=test, content_rowid=id
+ );
+
+ INSERT INTO test_idx(rowid, name) VALUES(123, 'one one one');
+ INSERT INTO test_idx(rowid, name) VALUES(124, 'two two two');
+ INSERT INTO test_idx(rowid, name) VALUES(125, 'two two two');
+ INSERT INTO test_idx (test_idx, rowid, name) VALUES('delete', 123, 'one');
+ INSERT INTO test_idx (test_idx, rowid, name) VALUES('delete', 123, 'one');
+ INSERT INTO test_idx (test_idx, rowid, name) VALUES('delete', 123, 'one');
+}
+
+do_catchsql_test 2.4 {
+ SELECT rowid FROM test_idx WHERE test_idx MATCH 'two' ORDER BY rank;
+} {1 {database disk image is malformed}}
+
+
+
finish_test
diff --git a/manifest b/manifest
index 2d094ed03a..efae1e261f 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Try\sagain\sto\sfix\sthe\stypo\sin\sthe\ssqlite3_txn_state()\sdocumentation.
-D 2020-09-10T15:09:11.613
+C Catch\sfts5\sindex\scorruption\scaused\sby\sissuing\s'delete'\scommands\swith\sincorrect\sdata\searlier\sin\ssome\scases.\sAlso\sfix\sa\scouple\sof\stest\sscript\sproblems.
+D 2020-09-11T15:01:49.870
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -116,11 +116,11 @@ F ext/fts5/fts5Int.h d7cbc214ee167496f70905667e18f73ea0402f7ef09236ce305e117e0ef
F ext/fts5/fts5_aux.c dcc627d8b6e3fc773db528ff67b39955dab7b51628f9dba8e15849e5bedfd7fa
F ext/fts5/fts5_buffer.c 5a5fe0159752c0fb0a5a93c722e9db2662822709490769d482b76a6dc8aaca70
F ext/fts5/fts5_config.c b447948f35ad3354e8fe5e242e0a7e7b5b941555400b9404259944e3aa570037
-F ext/fts5/fts5_expr.c 6393974bd3968280fa5275c26a41d837701d27793a2f025b9e7329bdbfbb274a
+F ext/fts5/fts5_expr.c b7b28ed203a3140f2fc503507d2c614a6cf1bd2e8987497f8894abc3f1477ec4
F ext/fts5/fts5_hash.c 1cc0095646f5f3b46721aa112fb4f9bf29ae175cb5338f89dcec66ed97acfe75
F ext/fts5/fts5_index.c de14c9a30f45e2b847ff9284b14776d9d07961e545e8f1546a6aa3f915af721f
F ext/fts5/fts5_main.c e881a2ea0bf01b3a3ff0bc1b31373c58fd54b6c9f3c43ea3d431bea4e5d4025e
-F ext/fts5/fts5_storage.c 3ecda8edadc1f62a355d6789776be0da609f8658c50d72e422674093ab7e1528
+F ext/fts5/fts5_storage.c 34774cac00302fee7c6ffe05e12ec38f90777fb1681245538c97357cf5eb5d0e
F ext/fts5/fts5_tcl.c 39bcbae507f594aad778172fa914cad0f585bf92fd3b078c686e249282db0d95
F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee
F ext/fts5/fts5_test_tok.c f96c6e193c466711d6d7828d5f190407fe7ab897062d371426dd3036f01258e7
@@ -159,9 +159,9 @@ F ext/fts5/test/fts5connect.test 08030168fc96fc278fa81f28654fb7e90566f33aff269c0
F ext/fts5/test/fts5content.test 213506436fb2c87567b8e31f6d43ab30aab99354cec74ed679f22aad0cdbf283
F ext/fts5/test/fts5corrupt.test 77ae6f41a7eba10620efb921cf7dbe218b0ef232b04519deb43581cb17a57ebe
F ext/fts5/test/fts5corrupt2.test 7453752ba12ce91690c469a6449d412561cc604b1dec994e16ab132952e7805f
-F ext/fts5/test/fts5corrupt3.test 7afe0fea5b2160798fdc3306395048768c6fc13acefc0e7129d4075b6e1bb224
+F ext/fts5/test/fts5corrupt3.test 4f5b2f278c1ce8a03b3de77de3bd698216986cc3f6b8428075708ae9eebe0656
F ext/fts5/test/fts5corrupt4.test ea805c4d7c68b5f185b9db5d2060a7ae5875339738dd48203c92162f41e7ca91
-F ext/fts5/test/fts5delete.test cbf87e3b8867c4d5cfcaed975c7475fd3f99d072bce2075fcedf43d1f82af775
+F ext/fts5/test/fts5delete.test 4a15fb03b6c7eac62ac807a3a32b7f0dc74f0d479c410e3e3568ae96b9469290
F ext/fts5/test/fts5detail.test 31b240dbf6d44ac3507e2f8b65f29fdc12465ffd531212378c7ce1066766f54e
F ext/fts5/test/fts5determin.test 1b77879b2ae818b5b71c859e534ee334dac088b7cf3ff3bf76a2c82b1c788d11
F ext/fts5/test/fts5dlidx.test b90852c55881b29dbac6380b274de27beae623ac4b6d567c6c8fb9cdc315a86e
@@ -1880,7 +1880,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 23f7d01758cbcf22bd34e78fb8284c7af18f3059a03c4ff6ab3e556ca11fce19
-R ea5549217c8e8fbad65a7e34d8502e26
-U drh
-Z a0388bd7f98f862d9d5f5978cc68a2fa
+P 6d1ab0403c2855b595f5d294305f41f56a7a93503f2a58d1b1d12431d480704e
+R a38b48cd74aa4d6bef7f94508a082c8f
+U dan
+Z 193f568f2cae72499a3bb6bc16e95901
diff --git a/manifest.uuid b/manifest.uuid
index ff699a6350..973325009f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-6d1ab0403c2855b595f5d294305f41f56a7a93503f2a58d1b1d12431d480704e
\ No newline at end of file
+b79f19edfd33c2a75f936c352668e14e81f35acf4f07edc27a21f941a7304b38
\ No newline at end of file
From ddcfe9210522ca4c5550b18b209df38c49a698f5 Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 15 Sep 2020 12:29:35 +0000
Subject: [PATCH 059/169] Do not invoke usleep() for more than 999999
microseconds.
FossilOrigin-Name: 1f5ed852f25515bbc0a7aaf236fdef40fa7e31805eee1249277fde4e68f95130
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
src/os_unix.c | 12 ++++++++----
src/shell.c.in | 15 +++++++++++++++
4 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/manifest b/manifest
index efae1e261f..a72e1de590 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Catch\sfts5\sindex\scorruption\scaused\sby\sissuing\s'delete'\scommands\swith\sincorrect\sdata\searlier\sin\ssome\scases.\sAlso\sfix\sa\scouple\sof\stest\sscript\sproblems.
-D 2020-09-11T15:01:49.870
+C Do\snot\sinvoke\susleep()\sfor\smore\sthan\s999999\smicroseconds.
+D 2020-09-15T12:29:35.316
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -519,7 +519,7 @@ F src/os.c 80e4cf3e5da06be03ca641661e331ce60eeeeabf0d7354dbb1c0e166d0eedbbe
F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c 99a6ace048b97b0fa6cab3b9216b9e65c3f876095f2adb5adbce41fa1664bc92
+F src/os_unix.c b16ae8f19de9fb91836164b8ff122c069d0b177179df7bb632cf41bf61308d89
F src/os_win.c a2149ff0a85c1c3f9cc102a46c673ce87e992396ba3411bfb53db66813b32f1d
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
@@ -536,7 +536,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
-F src/shell.c.in a53743f2f44c59675baa9d7b2e1398e80b2913c752686a40d9c172372368113b
+F src/shell.c.in 0fd9eca42731d94a293d7b12a76c6614976f8bdbb2874768ad2e6ddbb86dffd8
F src/sqlite.h.in 11896ccb28f85b0aa52f0d4169aaca0ed7cf3f9b3e0c544aecee0032ae2b3c2e
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1880,7 +1880,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 6d1ab0403c2855b595f5d294305f41f56a7a93503f2a58d1b1d12431d480704e
-R a38b48cd74aa4d6bef7f94508a082c8f
-U dan
-Z 193f568f2cae72499a3bb6bc16e95901
+P b79f19edfd33c2a75f936c352668e14e81f35acf4f07edc27a21f941a7304b38
+R 02ff44ae0857613afbe5632caeb73c7f
+U drh
+Z dea6a3dde210fb6493351086dc86d60e
diff --git a/manifest.uuid b/manifest.uuid
index 973325009f..aaac7772fa 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-b79f19edfd33c2a75f936c352668e14e81f35acf4f07edc27a21f941a7304b38
\ No newline at end of file
+1f5ed852f25515bbc0a7aaf236fdef40fa7e31805eee1249277fde4e68f95130
\ No newline at end of file
diff --git a/src/os_unix.c b/src/os_unix.c
index ac5c33e82f..6c7227c350 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1545,6 +1545,9 @@ static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){
return rc;
}
+/* Forward declaration*/
+static int unixSleep(sqlite3_vfs*,int);
+
/*
** Set a posix-advisory-lock.
**
@@ -1574,7 +1577,7 @@ static int osSetPosixAdvisoryLock(
** generic posix, however, there is no such API. So we simply try the
** lock once every millisecond until either the timeout expires, or until
** the lock is obtained. */
- usleep(1000);
+ unixSleep(0,1000);
rc = osFcntl(h,F_SETLK,pLock);
tm--;
}
@@ -6576,7 +6579,8 @@ static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){
UNUSED_PARAMETER(NotUsed);
return microseconds;
#elif defined(HAVE_USLEEP) && HAVE_USLEEP
- usleep(microseconds);
+ if( microseconds>=1000000 ) sleep(microseconds/1000000);
+ if( microseconds%1000000 ) usleep(microseconds%1000000);
UNUSED_PARAMETER(NotUsed);
return microseconds;
#else
@@ -7149,7 +7153,7 @@ static int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){
if( nTries==1 ){
conchModTime = buf.st_mtimespec;
- usleep(500000); /* wait 0.5 sec and try the lock again*/
+ unixSleep(0,500000); /* wait 0.5 sec and try the lock again*/
continue;
}
@@ -7175,7 +7179,7 @@ static int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){
/* don't break the lock on short read or a version mismatch */
return SQLITE_BUSY;
}
- usleep(10000000); /* wait 10 sec and try the lock again */
+ unixSleep(0,10000000); /* wait 10 sec and try the lock again */
continue;
}
diff --git a/src/shell.c.in b/src/shell.c.in
index 9a829bb8c8..1e3a07fe40 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -4425,6 +4425,19 @@ static void shellIdQuote(
}
}
+/*
+** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
+*/
+static void shellUSleepFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ int sleep = sqlite3_value_int(argv[0]);
+ sqlite3_sleep(sleep/1000);
+ sqlite3_result_int(context, sleep);
+}
+
/*
** Scalar function "shell_escape_crnl" used by the .recover command.
** The argument passed to this function is the output of built-in
@@ -4609,6 +4622,8 @@ static void open_db(ShellState *p, int openFlags){
shellInt32, 0, 0);
sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
shellIdQuote, 0, 0);
+ sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
+ shellUSleepFunc, 0, 0);
#ifndef SQLITE_NOHAVE_SYSTEM
sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
editFunc, 0, 0);
From b5a69238b42fff179af63a3d88ec8f3bf135543b Mon Sep 17 00:00:00 2001
From: dan
Date: Tue, 15 Sep 2020 20:48:30 +0000
Subject: [PATCH 060/169] Fix a buffer overread found by OSSFuzz that could
occur if a WITHOUT ROWID table with many columns was NATURAL JOINed against
itself.
FossilOrigin-Name: 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
src/build.c | 5 ++++-
test/join6.test | 16 ++++++++++++++++
4 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/manifest b/manifest
index a72e1de590..3134eb5f9b 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Do\snot\sinvoke\susleep()\sfor\smore\sthan\s999999\smicroseconds.
-D 2020-09-15T12:29:35.316
+C Fix\sa\sbuffer\soverread\sfound\sby\sOSSFuzz\sthat\scould\soccur\sif\sa\sWITHOUT\sROWID\stable\swith\smany\scolumns\swas\sNATURAL\sJOINed\sagainst\sitself.
+D 2020-09-15T20:48:30.623
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 1fbb15cf6af2ccd4bc784f52bda7e6a860e303d677587b6a4b95d72ae36480a0
F src/btree.h c64f1439377e2edf31f7c3a562586a96b71f8d0ca47e65756e7d122fd8f06928
F src/btreeInt.h ffd66480520d9d70222171b3a026d78b80833b5cea49c89867949f3e023d5f43
-F src/build.c 92b61c2be1e35a619391f17c2d1b108901ad5e4df99becc0b064a934e6ec662a
+F src/build.c 55faabe78044063eae7d1cb3767afa1bafd6edc41d950b6e2228abf601f87912
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c e98518d2d3d4029a13c805e07313fb60c877be56db76e90dd5f3af73085d0ce6
@@ -1107,7 +1107,7 @@ F test/join2.test 21fc30e54ab35ed66bf51b89cec18729205497f5cc43c83bc042f96a737215
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/join5.test 3a96dc62f0b45402d7207e22d1993fe0c2fce1c57644a11439891dd62b990eb7
-F test/join6.test cfe6503791ceb0cbb509966740286ec423cbf10b
+F test/join6.test f809c025fa253f9e150c0e9afd4cef8813257bceeb6f46e04041228c9403cc2c
F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497
F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4
F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ffa140e
@@ -1880,7 +1880,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 b79f19edfd33c2a75f936c352668e14e81f35acf4f07edc27a21f941a7304b38
-R 02ff44ae0857613afbe5632caeb73c7f
-U drh
-Z dea6a3dde210fb6493351086dc86d60e
+P 1f5ed852f25515bbc0a7aaf236fdef40fa7e31805eee1249277fde4e68f95130
+R 159ee482f0e91b04b6a96e306747db16
+U dan
+Z 718c843037db5d7938afc4a375a76077
diff --git a/manifest.uuid b/manifest.uuid
index aaac7772fa..eeab54a17c 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-1f5ed852f25515bbc0a7aaf236fdef40fa7e31805eee1249277fde4e68f95130
\ No newline at end of file
+3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be
\ No newline at end of file
diff --git a/src/build.c b/src/build.c
index 1597f8bc33..907d4403d4 100644
--- a/src/build.c
+++ b/src/build.c
@@ -1891,12 +1891,15 @@ static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
int nByte;
if( pIdx->nColumn>=N ) return SQLITE_OK;
assert( pIdx->isResized==0 );
- nByte = (sizeof(char*) + sizeof(i16) + 1)*N;
+ nByte = (sizeof(char*) + sizeof(LogEst) + sizeof(i16) + 1)*N;
zExtra = sqlite3DbMallocZero(db, nByte);
if( zExtra==0 ) return SQLITE_NOMEM_BKPT;
memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);
pIdx->azColl = (const char**)zExtra;
zExtra += sizeof(char*)*N;
+ memcpy(zExtra, pIdx->aiRowLogEst, sizeof(LogEst)*(pIdx->nKeyCol+1));
+ pIdx->aiRowLogEst = (LogEst*)zExtra;
+ zExtra += sizeof(LogEst)*N;
memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);
pIdx->aiColumn = (i16*)zExtra;
zExtra += sizeof(i16)*N;
diff --git a/test/join6.test b/test/join6.test
index 7fbf508e57..802f1b3745 100644
--- a/test/join6.test
+++ b/test/join6.test
@@ -147,6 +147,22 @@ ifcapable compound {
} {1 91 92 3 93 5}
}
+do_execsql_test join6-5.1 {
+ CREATE TABLE tx(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o PRIMARY KEY)
+ WITHOUT ROWID;
+ INSERT INTO tx VALUES(
+ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+ );
+} {}
+do_execsql_test joint6-5.2 {
+ SELECT o FROM tx NATURAL JOIN tx;
+} {15}
+
+do_execsql_test join6-5.3 {
+ CREATE TABLE ty(a,Ñ,x6,x7,x8,Q,I,v,x1,L,E,x2,x3,x4,x5,s,g PRIMARY KEY,b,c)
+ WITHOUT ROWID;
+ SELECT a FROM ty NATURAL JOIN ty;
+}
From 18ef40e563e12e58402f87e5e5710001005da0d8 Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 16 Sep 2020 16:55:56 +0000
Subject: [PATCH 061/169] Fix harmless compiler warnings in Lemon.
FossilOrigin-Name: 6c94ba4b1c16b676978808dcb24f63c2f22915af5dcfe9f635c037011affcf4b
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
tool/lemon.c | 8 ++++----
tool/lempar.c | 2 +-
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/manifest b/manifest
index 3134eb5f9b..b042ce968f 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sbuffer\soverread\sfound\sby\sOSSFuzz\sthat\scould\soccur\sif\sa\sWITHOUT\sROWID\stable\swith\smany\scolumns\swas\sNATURAL\sJOINed\sagainst\sitself.
-D 2020-09-15T20:48:30.623
+C Fix\sharmless\scompiler\swarnings\sin\sLemon.
+D 2020-09-16T16:55:56.989
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1799,8 +1799,8 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c 68f547dabafdaedafe2e253651122de33340486c169ae67087ab0eb4fbc8a646
-F tool/lempar.c dc1f5e8a0847c2257b0b069c61e290227062c4d75f5b5a0797b75b08b1c00405
+F tool/lemon.c 28a0641683fa8786dd52d401f2b99727a0137832ebe97d822de6a493fe658abc
+F tool/lempar.c 70243f14640759cb1a8f048024daa5e54505e80e79ec02bc979edfd1a7c5e810
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
@@ -1880,7 +1880,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 1f5ed852f25515bbc0a7aaf236fdef40fa7e31805eee1249277fde4e68f95130
-R 159ee482f0e91b04b6a96e306747db16
-U dan
-Z 718c843037db5d7938afc4a375a76077
+P 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be
+R 27185f248a8d08f2569cea31fb11af65
+U drh
+Z d46cc13ad21ef0a53c46a80409f98715
diff --git a/manifest.uuid b/manifest.uuid
index eeab54a17c..c95d3e0fce 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be
\ No newline at end of file
+6c94ba4b1c16b676978808dcb24f63c2f22915af5dcfe9f635c037011affcf4b
\ No newline at end of file
diff --git a/tool/lemon.c b/tool/lemon.c
index a18f0a2629..82531362e7 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -1591,7 +1591,7 @@ static struct rule *Rule_merge(struct rule *pA, struct rule *pB){
** Sort a list of rules in order of increasing iRule value
*/
static struct rule *Rule_sort(struct rule *rp){
- int i;
+ unsigned int i;
struct rule *pNext;
struct rule *x[32];
memset(x, 0, sizeof(x));
@@ -1625,8 +1625,7 @@ static void stats_line(const char *zLabel, int iValue){
}
/* The main program. Parse the command line and do it... */
-int main(int argc, char **argv)
-{
+int main(int argc, char **argv){
static int version = 0;
static int rpflag = 0;
static int basisflag = 0;
@@ -1669,6 +1668,7 @@ int main(int argc, char **argv)
struct lemon lem;
struct rule *rp;
+ (void)argc;
OptInit(argv,options,stderr);
if( version ){
printf("Lemon version 1.0\n");
@@ -2266,7 +2266,7 @@ static void parseonetoken(struct pstate *psp)
psp->preccounter = 0;
psp->firstrule = psp->lastrule = 0;
psp->gp->nrule = 0;
- /* Fall thru to next case */
+ /* fall through */
case WAITING_FOR_DECL_OR_RULE:
if( x[0]=='%' ){
psp->state = WAITING_FOR_DECL_KEYWORD;
diff --git a/tool/lempar.c b/tool/lempar.c
index ef3148551e..079635b21f 100644
--- a/tool/lempar.c
+++ b/tool/lempar.c
@@ -559,7 +559,7 @@ static YYACTIONTYPE yy_find_shift_action(
#endif /* YYWILDCARD */
return yy_default[stateno];
}else{
- assert( i>=0 && i=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) );
return yy_action[i];
}
}while(1);
From d96e3821e4a14a0b41c32667d1642fcd7228c9fa Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 16 Sep 2020 19:48:23 +0000
Subject: [PATCH 062/169] Fix a pair of assert()s in "PRAGMA foreign_key_check"
that might have given a false-positive following an OOM.
FossilOrigin-Name: 9ea3039b538ffd0f348c8fbc9452af1fbf899a1f668af9a2404bdd0f8dd21351
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/pragma.c | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index b042ce968f..069f1645cd 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sharmless\scompiler\swarnings\sin\sLemon.
-D 2020-09-16T16:55:56.989
+C Fix\sa\spair\sof\sassert()s\sin\s"PRAGMA\sforeign_key_check"\sthat\smight\shave\sgiven\na\sfalse-positive\sfollowing\san\sOOM.
+D 2020-09-16T19:48:23.775
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -528,7 +528,7 @@ F src/parse.y 9ce4dfb772608ed5bd3c32f33e943e021e3b06cfd2c01932d4280888fdd2ebed
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
-F src/pragma.c 5435b9fe17f7728bd460f52d6d9388e7e45658c6f5549f28fc2d408be9efd2d5
+F src/pragma.c 6daaaecc26a4b09481d21722525b079ce756751a43a79cc1d8f122d686806193
F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
F src/prepare.c 270170a239c0f66bd3c228f373afe24447c2614a6829ae22080babc64f241931
F src/printf.c 30e92b638fac71dcd85cdea1d12ecfae354c9adee2c71e8e1ae4727cde7c91ed
@@ -1880,7 +1880,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 3d35fa0be866213274fc09250225b345f6b08a9b4ec373d53d95e627e24512be
-R 27185f248a8d08f2569cea31fb11af65
+P 6c94ba4b1c16b676978808dcb24f63c2f22915af5dcfe9f635c037011affcf4b
+R 38e8b34a5e2ff3cf94eaf76807abdad3
U drh
-Z d46cc13ad21ef0a53c46a80409f98715
+Z 188d1d8f2a6059fab39eb41cb4a67396
diff --git a/manifest.uuid b/manifest.uuid
index c95d3e0fce..bce527ad9f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-6c94ba4b1c16b676978808dcb24f63c2f22915af5dcfe9f635c037011affcf4b
\ No newline at end of file
+9ea3039b538ffd0f348c8fbc9452af1fbf899a1f668af9a2404bdd0f8dd21351
\ No newline at end of file
diff --git a/src/pragma.c b/src/pragma.c
index df7d2c943b..7be0f7f256 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -1453,7 +1453,7 @@ void sqlite3Pragma(
aiCols = 0;
if( pParent ){
x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols);
- assert( x==0 );
+ assert( x==0 || db->mallocFailed );
}
addrOk = sqlite3VdbeMakeLabel(pParse);
@@ -1478,7 +1478,7 @@ void sqlite3Pragma(
int jmp = sqlite3VdbeCurrentAddr(v)+2;
sqlite3VdbeAddOp3(v, OP_SeekRowid, i, jmp, regRow); VdbeCoverage(v);
sqlite3VdbeGoto(v, addrOk);
- assert( pFK->nCol==1 );
+ assert( pFK->nCol==1 || db->mallocFailed );
}
/* Generate code to report an FK violation to the caller. */
From f1ea42556073c45dc07c31631f4cd12938761889 Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 17 Sep 2020 00:46:09 +0000
Subject: [PATCH 063/169] DISTINCT may not be ignored inside a UNION ALL common
table expression. Fix for ticket [c51489c3b8f919c5]
FossilOrigin-Name: 7d2b590d3abd66a7e6ae9046198eb669e0fd2f223f7691281e9ad795a12b8903
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
src/select.c | 12 +++++-------
src/sqliteInt.h | 16 +++++++++-------
test/with1.test | 36 ++++++++++++++++++++++++++++++++++++
5 files changed, 59 insertions(+), 23 deletions(-)
diff --git a/manifest b/manifest
index 069f1645cd..278b587ac8 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\spair\sof\sassert()s\sin\s"PRAGMA\sforeign_key_check"\sthat\smight\shave\sgiven\na\sfalse-positive\sfollowing\san\sOOM.
-D 2020-09-16T19:48:23.775
+C DISTINCT\smay\snot\sbe\signored\sinside\sa\sUNION\sALL\scommon\stable\sexpression.\nFix\sfor\sticket\s[c51489c3b8f919c5]
+D 2020-09-17T00:46:09.055
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -535,12 +535,12 @@ F src/printf.c 30e92b638fac71dcd85cdea1d12ecfae354c9adee2c71e8e1ae4727cde7c91ed
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
-F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
+F src/select.c 6c3f7d60295f06ce7fa128bb23b1159648f0aa96a78c257af35dfef727ac63f1
F src/shell.c.in 0fd9eca42731d94a293d7b12a76c6614976f8bdbb2874768ad2e6ddbb86dffd8
F src/sqlite.h.in 11896ccb28f85b0aa52f0d4169aaca0ed7cf3f9b3e0c544aecee0032ae2b3c2e
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
-F src/sqliteInt.h d8d69318b1ba3906d4860da1cd1c6b3650b81c9595e5bc360c6469a1e54e09e1
+F src/sqliteInt.h 34319c13e900063b267052168b277c7bc1e124a1ceef457e450d53ce618bb96e
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -1759,7 +1759,7 @@ F test/windowB.test 7a983ea1cc1cf72be7f378e4b32f6cb2d73014c5cd8b25aaee825164cd42
F test/windowerr.tcl f5acd6fbc210d7b5546c0e879d157888455cd4a17a1d3f28f07c1c8a387019e0
F test/windowerr.test a8b752402109c15aa1c5efe1b93ccb0ce1ef84fa964ae1cd6684dd0b3cc1819b
F test/windowfault.test 72375ae71031eabf96bc88d0af128c8628a091ddc99b5a394e848b3df5fc17ad
-F test/with1.test 584580a5ae79868a91873863f8cb2d00040006dc1e4c332ef1d8642f2815dc6e
+F test/with1.test 323659eaf309787add657d05e5943e437a7a3494f2b6602a0deb18fdebc1ab4c
F test/with2.test e0030e2f0267a910d6c0e4f46f2dfe941c1cc0d4f659ba69b3597728e7e8f1ab
F test/with3.test 13b3336739da648a9e4dfa11bb04e73a920c97620041007c5f75d5d14084c346
F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f198205
@@ -1880,7 +1880,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 6c94ba4b1c16b676978808dcb24f63c2f22915af5dcfe9f635c037011affcf4b
-R 38e8b34a5e2ff3cf94eaf76807abdad3
+P 9ea3039b538ffd0f348c8fbc9452af1fbf899a1f668af9a2404bdd0f8dd21351
+R 5bf1eaed1b0f62e19f1e327d7467bbe1
U drh
-Z 188d1d8f2a6059fab39eb41cb4a67396
+Z 6e1d5387493b3a726ae70a6af2467d64
diff --git a/manifest.uuid b/manifest.uuid
index bce527ad9f..22a693b7d8 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-9ea3039b538ffd0f348c8fbc9452af1fbf899a1f668af9a2404bdd0f8dd21351
\ No newline at end of file
+7d2b590d3abd66a7e6ae9046198eb669e0fd2f223f7691281e9ad795a12b8903
\ No newline at end of file
diff --git a/src/select.c b/src/select.c
index 9568dbadc9..535f883a17 100644
--- a/src/select.c
+++ b/src/select.c
@@ -5808,13 +5808,11 @@ int sqlite3Select(
assert( p->pOrderBy==0 || pDest->eDest!=SRT_Fifo );
assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistQueue );
assert( p->pOrderBy==0 || pDest->eDest!=SRT_Queue );
- if( IgnorableOrderby(pDest) ){
- assert(pDest->eDest==SRT_Exists || pDest->eDest==SRT_Union ||
- pDest->eDest==SRT_Except || pDest->eDest==SRT_Discard ||
- pDest->eDest==SRT_Queue || pDest->eDest==SRT_DistFifo ||
- pDest->eDest==SRT_DistQueue || pDest->eDest==SRT_Fifo);
- /* If ORDER BY makes no difference in the output then neither does
- ** DISTINCT so it can be removed too. */
+ if( IgnorableDistinct(pDest) ){
+ assert(pDest->eDest==SRT_Exists || pDest->eDest==SRT_Union ||
+ pDest->eDest==SRT_Except || pDest->eDest==SRT_Discard ||
+ pDest->eDest==SRT_DistQueue || pDest->eDest==SRT_DistFifo );
+ /* All of these destinations are also able to ignore the ORDER BY clause */
sqlite3ExprListDelete(db, p->pOrderBy);
p->pOrderBy = 0;
p->selFlags &= ~SF_Distinct;
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 9afc287a5b..ec832eca6a 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -3152,9 +3152,6 @@ struct Select {
** statements within triggers whose only purpose is
** the side-effects of functions.
**
-** All of the above are free to ignore their ORDER BY clause. Those that
-** follow must honor the ORDER BY clause.
-**
** SRT_Output Generate a row of output (using the OP_ResultRow
** opcode) for each row in the result set.
**
@@ -3211,13 +3208,18 @@ struct Select {
#define SRT_Except 2 /* Remove result from a UNION index */
#define SRT_Exists 3 /* Store 1 if the result is not empty */
#define SRT_Discard 4 /* Do not save the results anywhere */
-#define SRT_Fifo 5 /* Store result as data with an automatic rowid */
-#define SRT_DistFifo 6 /* Like SRT_Fifo, but unique results only */
+#define SRT_DistFifo 5 /* Like SRT_Fifo, but unique results only */
+#define SRT_DistQueue 6 /* Like SRT_Queue, but unique results only */
+
+/* The DISTINCT clause is ignored for all of the above. Not that
+** IgnorableDistinct() implies IgnorableOrderby() */
+#define IgnorableDistinct(X) ((X->eDest)<=SRT_DistQueue)
+
#define SRT_Queue 7 /* Store result in an queue */
-#define SRT_DistQueue 8 /* Like SRT_Queue, but unique results only */
+#define SRT_Fifo 8 /* Store result as data with an automatic rowid */
/* The ORDER BY clause is ignored for all of the above */
-#define IgnorableOrderby(X) ((X->eDest)<=SRT_DistQueue)
+#define IgnorableOrderby(X) ((X->eDest)<=SRT_Fifo)
#define SRT_Output 9 /* Output each row of result */
#define SRT_Mem 10 /* Store result in a memory cell */
diff --git a/test/with1.test b/test/with1.test
index 66e456345c..5386f7ddb0 100644
--- a/test/with1.test
+++ b/test/with1.test
@@ -1171,4 +1171,40 @@ do_catchsql_test 26.0 {
SELECT x,O. * O FROM i ¬I,I? 10;
} {1 {near "O": syntax error}}
+# 2020-09-17 ticket c51489c3b8f919c5
+# DISTINCT cannot be ignored in a UNION ALL recursive CTE
+#
+reset_db
+do_execsql_test 26.1 {
+ CREATE TABLE t (label VARCHAR(10), step INTEGER);
+ INSERT INTO T VALUES('a', 1);
+ INSERT INTO T VALUES('a', 1);
+ INSERT INTO T VALUES('b', 1);
+ WITH RECURSIVE cte(label, step) AS (
+ SELECT DISTINCT * FROM t
+ UNION ALL
+ SELECT label, step + 1 FROM cte WHERE step < 3
+ )
+ SELECT * FROM cte ORDER BY +label, +step;
+} {a 1 a 2 a 3 b 1 b 2 b 3}
+do_execsql_test 26.2 {
+ WITH RECURSIVE cte(label, step) AS (
+ SELECT * FROM t
+ UNION
+ SELECT label, step + 1 FROM cte WHERE step < 3
+ )
+ SELECT * FROM cte ORDER BY +label, +step;
+} {a 1 a 2 a 3 b 1 b 2 b 3}
+do_execsql_test 26.3 {
+ CREATE TABLE tworow(x);
+ INSERT INTO tworow(x) VALUES(1),(2);
+ DELETE FROM t WHERE rowid=2;
+ WITH RECURSIVE cte(label, step) AS (
+ SELECT * FROM t
+ UNION ALL
+ SELECT DISTINCT label, step + 1 FROM cte, tworow WHERE step < 3
+ )
+ SELECT * FROM cte ORDER BY +label, +step;
+} {a 1 a 2 a 3 b 1 b 2 b 3}
+
finish_test
From bc2e95140b7ff79b26a9ff78cd089e63df7d0fef Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 17 Sep 2020 11:32:14 +0000
Subject: [PATCH 064/169] Prevent use-after-free of the u.vtab.idxStr string
following an OOM while generating the OP_VFilter opcode.
FossilOrigin-Name: 751fe4edb2d4602e652523c2759de3f4fffd29d5c66cae68caf45b30fd8b750a
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/wherecode.c | 3 +++
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/manifest b/manifest
index 278b587ac8..739315cf00 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C DISTINCT\smay\snot\sbe\signored\sinside\sa\sUNION\sALL\scommon\stable\sexpression.\nFix\sfor\sticket\s[c51489c3b8f919c5]
-D 2020-09-17T00:46:09.055
+C Prevent\suse-after-free\sof\sthe\su.vtab.idxStr\sstring\sfollowing\san\sOOM\nwhile\sgenerating\sthe\sOP_VFilter\sopcode.
+D 2020-09-17T11:32:14.578
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c 23f47e845e304a41d0b221bf67bd170014ae08b673076813fcd945dda1a3d4af
F src/whereInt.h eb8c2847fb464728533777efec1682b3c074224293b2da73513c61a609efbeab
-F src/wherecode.c 8b1176a3b7d4d61f78b0516bb7f6bb3803c658a6565663b8414c3b5d37a02eaa
+F src/wherecode.c 9afd600ca9fe831f342121cca48ad8839c8a18ca4e0372518a0a3c8123a8f022
F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1880,7 +1880,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 9ea3039b538ffd0f348c8fbc9452af1fbf899a1f668af9a2404bdd0f8dd21351
-R 5bf1eaed1b0f62e19f1e327d7467bbe1
+P 7d2b590d3abd66a7e6ae9046198eb669e0fd2f223f7691281e9ad795a12b8903
+R 64b915f5a215a95424570ee566dcd81b
U drh
-Z 6e1d5387493b3a726ae70a6af2467d64
+Z ee1bdda50dc146e98a6a3caca7097de2
diff --git a/manifest.uuid b/manifest.uuid
index 22a693b7d8..67e30802d8 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-7d2b590d3abd66a7e6ae9046198eb669e0fd2f223f7691281e9ad795a12b8903
\ No newline at end of file
+751fe4edb2d4602e652523c2759de3f4fffd29d5c66cae68caf45b30fd8b750a
\ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index 591f267e82..ae3a197570 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1397,6 +1397,9 @@ Bitmask sqlite3WhereCodeOneLoopStart(
pLoop->u.vtab.needFree ? P4_DYNAMIC : P4_STATIC);
VdbeCoverage(v);
pLoop->u.vtab.needFree = 0;
+ /* An OOM inside of AddOp4(OP_VFilter) instruction above might have freed
+ ** the u.vtab.idxStr. NULL it out to prevent a use-after-free */
+ if( db->mallocFailed ) pLoop->u.vtab.idxStr = 0;
pLevel->p1 = iCur;
pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext;
pLevel->p2 = sqlite3VdbeCurrentAddr(v);
From f2fa084cf1104e9ec96d2dfc063952baafaf1883 Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 17 Sep 2020 11:56:04 +0000
Subject: [PATCH 065/169] Earlier detection of corruption in the rtreecheck()
SQL function to prevent a (harmless) read of an uninitialized value.
FossilOrigin-Name: e2074b24788149562b15022ccd2784d6649f08ebc41410e3bfb2401baf0892e2
---
ext/rtree/rtree.c | 2 +-
manifest | 12 ++++++------
manifest.uuid | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c
index df0f6c2e27..f5b57a5e23 100644
--- a/ext/rtree/rtree.c
+++ b/ext/rtree/rtree.c
@@ -759,7 +759,7 @@ static int nodeAcquire(
** are the leaves, and so on. If the depth as specified on the root node
** is greater than RTREE_MAX_DEPTH, the r-tree structure must be corrupt.
*/
- if( pNode && iNode==1 ){
+ if( pNode && rc==SQLITE_OK && iNode==1 ){
pRtree->iDepth = readInt16(pNode->zData);
if( pRtree->iDepth>RTREE_MAX_DEPTH ){
rc = SQLITE_CORRUPT_VTAB;
diff --git a/manifest b/manifest
index 739315cf00..eced676a27 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Prevent\suse-after-free\sof\sthe\su.vtab.idxStr\sstring\sfollowing\san\sOOM\nwhile\sgenerating\sthe\sOP_VFilter\sopcode.
-D 2020-09-17T11:32:14.578
+C Earlier\sdetection\sof\scorruption\sin\sthe\srtreecheck()\sSQL\sfunction\sto\sprevent\na\s(harmless)\sread\sof\san\suninitialized\svalue.
+D 2020-09-17T11:56:04.753
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -388,7 +388,7 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/geopoly.c f15cc6845d64a629035627d863cbe3eadc9cb30f9ca77bd823b0ca8a5a3f8b00
-F ext/rtree/rtree.c f87ffcc91f49272862119cfdd256b02514351893786a710d88f85933790608d4
+F ext/rtree/rtree.c 60f6f1675134201974be4189dbd219494c13e1ed30e80bd92ae0dcc86df1b035
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 00792b030a4e188ff1b22e8530e8aa0452bb5dd81c2b18cb004afc7dc63e040e
F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d
@@ -1880,7 +1880,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 7d2b590d3abd66a7e6ae9046198eb669e0fd2f223f7691281e9ad795a12b8903
-R 64b915f5a215a95424570ee566dcd81b
+P 751fe4edb2d4602e652523c2759de3f4fffd29d5c66cae68caf45b30fd8b750a
+R 46006fc1e92c35a627434427e02a14ec
U drh
-Z ee1bdda50dc146e98a6a3caca7097de2
+Z 71d35069d355b0f119ebbc1395c98fe2
diff --git a/manifest.uuid b/manifest.uuid
index 67e30802d8..3dd2d87f5d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-751fe4edb2d4602e652523c2759de3f4fffd29d5c66cae68caf45b30fd8b750a
\ No newline at end of file
+e2074b24788149562b15022ccd2784d6649f08ebc41410e3bfb2401baf0892e2
\ No newline at end of file
From 3acd3fb9d8bfe867c6e4015720569b23bffaf4fb Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 17 Sep 2020 14:16:02 +0000
Subject: [PATCH 066/169] Fix a "jump depends on unitialized value"
valgrind/asan error in fts5.
FossilOrigin-Name: 66f94d623c16b4527e42f0519e32ec78eaf9ee6fd61ee7d0eb657cc59a8f7d68
---
ext/fts5/fts5_index.c | 9 ++-
ext/fts5/test/fts5corrupt3.test | 103 ++++++++++++++++++++++++++++++++
manifest | 16 ++---
manifest.uuid | 2 +-
4 files changed, 118 insertions(+), 12 deletions(-)
diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c
index 5e1155c2a9..d923a9d9df 100644
--- a/ext/fts5/fts5_index.c
+++ b/ext/fts5/fts5_index.c
@@ -4997,7 +4997,9 @@ static void fts5MergePrefixLists(
** at most 20 bytes of unexpected space. */
fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
fts5BufferZero(&tmp);
- sqlite3Fts5BufferSize(&p->rc, &tmp, i1.nPoslist + i2.nPoslist + 10 + 10);
+ sqlite3Fts5BufferSize(&p->rc, &tmp,
+ i1.nPoslist + i2.nPoslist + 10 + 10 + FTS5_DATA_ZERO_PADDING
+ );
if( p->rc ) break;
sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
@@ -5071,9 +5073,10 @@ static void fts5MergePrefixLists(
}
assert_nc( out.n<=(p1->n+p2->n+9) );
- fts5BufferSet(&p->rc, p1, out.n, out.p);
+ fts5BufferFree(p1);
fts5BufferFree(&tmp);
- fts5BufferFree(&out);
+ memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING);
+ *p1 = out;
}
}
diff --git a/ext/fts5/test/fts5corrupt3.test b/ext/fts5/test/fts5corrupt3.test
index 8b3e6c8dc3..a8a7ae9a54 100644
--- a/ext/fts5/test/fts5corrupt3.test
+++ b/ext/fts5/test/fts5corrupt3.test
@@ -10324,6 +10324,109 @@ do_catchsql_test 69.2 {
SELECT * FROM t1 WHERE a MATCH 'fx*'
} {1 {database disk image is malformed}}
+#-------------------------------------------------------------------------
+reset_db
+do_test 70.0 {
+ sqlite3 db {}
+ db deserialize [decode_hexdb {
+.open --hexdb
+| size 24576 pagesize 4096 filename sql022250.txt.db
+| page 1 offset 0
+| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
+| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00 .....@ ........
+| 96: 00 00 00 00 0d 00 00 00 06 0d e2 00 0f c4 0f 6a ...............j
+| 112: 0e fc 0e 9d 0e 3d 0d e2 00 00 00 00 00 00 00 00 .....=..........
+| 3552: 00 00 59 06 06 17 21 21 01 7f 74 61 62 6c 65 74 ..Y...!!..tablet
+| 3568: 74 74 5f 63 6f 6e 66 69 67 74 74 74 5f 63 6f 6e tt_configttt_con
+| 3584: 66 69 67 06 43 52 45 41 54 45 20 54 41 42 4c 45 fig.CREATE TABLE
+| 3600: 20 27 74 74 74 5f 63 6f 6e 66 69 67 27 28 6b 20 'ttt_config'(k
+| 3616: 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29 20 PRIMARY KEY, v)
+| 3632: 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5e 15 07 WITHOUT ROWID^..
+| 3648: 17 23 23 01 81 03 74 61 62 6c 65 74 74 74 5f 64 .##...tablettt_d
+| 3664: 6f 63 73 69 7a 65 74 74 74 5f 64 6f 63 73 69 7a ocsizettt_docsiz
+| 3680: 65 05 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 e.CREATE TABLE '
+| 3696: 74 74 74 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 ttt_docsize'(id
+| 3712: 49 4d 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 IMTEGER PRIMARY
+| 3728: 4b 45 59 2c 20 73 7a 20 42 4c 4f 20 29 5d 04 07 KEY, sz BLO )]..
+| 3744: 17 23 23 01 81 01 74 61 62 6c 65 74 74 74 5f 63 .##...tablettt_c
+| 3760: 6f 6e 74 65 6e 74 74 74 74 5f 63 6f 6e 74 65 6e ontentttt_conten
+| 3776: 74 04 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 t.CREATE TABLE '
+| 3792: 74 74 74 5f 63 6f 6e 74 65 6e 74 27 28 69 64 20 ttt_content'(id
+| 3808: 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 INTEGER PRIMARY
+| 3824: 4b 45 59 2c 20 63 30 2c 20 63 31 29 6c 03 07 17 KEY, c0, c1)l...
+| 3840: 1b 1b 01 81 2f 74 61 62 6c 65 74 74 74 5f 69 64 ..../tablettt_id
+| 3856: 78 74 74 74 5f 69 64 78 03 43 52 45 41 54 45 20 xttt_idx.CREATE
+| 3872: 54 41 42 4c 45 20 27 74 74 74 5f 69 64 78 27 28 TABLE 'ttt_idx'(
+| 3888: 73 65 67 69 64 2c 20 74 65 72 6d 2c 20 70 67 6e segid, term, pgn
+| 3904: 6f 2c 20 50 52 49 4d 41 52 59 20 4b 45 59 28 73 o, PRIMARY KEY(s
+| 3920: 65 67 69 64 2c 20 74 65 72 6d 29 29 20 57 49 54 egid, term)) WIT
+| 3936: 48 4f 55 54 20 52 4f 57 49 44 58 02 07 17 1d 1d HOUT ROWIDX.....
+| 3952: 01 81 03 74 61 62 6c 65 74 74 74 5f 64 61 74 61 ...tablettt_data
+| 3968: 74 74 74 5f 64 61 74 61 02 43 52 45 41 54 45 20 ttt_data.CREATE
+| 3984: 54 41 42 4c 45 20 27 74 74 74 5f 64 61 74 61 27 TABLE 'ttt_data'
+| 4000: 28 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d (id INTEGER PRIM
+| 4016: 41 52 59 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 ARY KEY, block B
+| 4032: 4c 4f 42 29 3a 01 06 17 13 13 08 5f 74 61 62 6c LOB):......_tabl
+| 4048: 65 74 74 74 74 74 74 43 52 45 41 54 45 20 56 49 ettttttCREATE VI
+| 4064: 52 54 55 41 4c 20 54 41 42 4c 45 20 74 74 74 20 RTUAL TABLE ttt
+| 4080: 55 53 49 4e 47 20 66 74 73 35 28 61 2c 20 62 29 USING fts5(a, b)
+| page 2 offset 4096
+| 0: 0d 0f 54 00 05 0e 81 00 0f e7 0e 81 0f af 0f 58 ..T............X
+| 16: 0e 98 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+| 3712: 00 15 0a 03 00 30 00 00 00 00 01 03 03 00 03 01 .....0..........
+| 3728: 01 01 02 01 01 03 01 01 81 24 8c 80 80 80 80 01 .........$......
+| 3744: 04 00 82 4c 00 00 00 9b 02 30 65 03 1a 02 05 05 ...L.....0e.....
+| 3760: 07 05 01 01 04 03 03 08 03 03 01 2e 02 05 05 07 ................
+| 3776: 05 07 05 07 05 01 01 14 03 03 08 03 03 08 03 bf ................
+| 3792: 07 f2 f3 02 01 65 03 1e 03 05 05 04 05 05 01 01 .....e..........
+| 3808: 03 06 04 04 06 04 03 01 36 03 05 05 04 05 05 04 ........6.......
+| 3824: 05 15 04 05 05 01 01 03 06 04 04 06 04 04 a1 04 ................
+| 3840: 04 06 04 03 03 01 65 03 14 04 05 07 05 05 01 01 ......e.........
+| 3856: 02 09 0a 01 20 04 05 07 05 07 05 07 05 05 01 01 .... ...........
+| 3872: 02 0f da 0a 0a 04 01 64 f3 02 0a 01 06 0a 0a 0a .......d........
+| 3888: 05 01 65 03 06 01 01 0a 01 0a 01 01 0a 0a 0a 04 ..e.............
+| 3904: 2b 31 21 0b 0f ef 00 14 2a 00 00 00 00 01 02 02 +1!.....*.......
+| 3920: 00 02 01 01 01 02 01 01 50 88 80 80 80 80 01 04 ........P.......
+| 3936: 00 81 24 00 00 00 47 01 30 65 02 1a 02 05 05 07 ..$...G.0e......
+| 3952: 05 01 01 04 03 03 08 03 03 02 01 65 02 1d f3 05 ...........e....
+| 3968: 05 04 05 05 01 01 04 06 04 04 06 04 03 03 01 65 ...............e
+| 3984: 02 14 04 05 07 05 05 01 01 02 08 0a 04 01 65 02 ..............e.
+| 4000: 02 0a 05 01 65 02 06 01 01 0a 04 12 14 0f 06 31 ....e..........1
+| 4016: 84 80 80 80 80 01 03 00 68 00 00 00 2b 02 30 65 ........h...+.0e
+| 4032: 01 10 02 05 05 01 01 04 03 03 02 01 66 01 12 03 ............f...
+| 4048: 05 05 01 01 03 06 04 03 03 01 65 01 0e 04 05 05 ..........e.....
+| 4064: 01 01 02 08 04 0d 0e 06 01 03 00 12 04 4c 4c 00 .............LL.
+| 4080: 00 00 11 24 00 00 00 00 01 01 01 00 01 01 01 01 ...$............
+| page 3 offset 8192
+| 0: 0a 2f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ./..............
+| page 4 offset 12288
+| 3344: 00 00 00 00 00 00 00 00 00 00 81 52 04 06 10 81 ...........R....
+| 3360: 5d 81 55 65 20 65 65 20 65 65 65 20 65 20 65 65 ].Ue ee eee e ee
+| 3376: 20 65 65 65 20 65 20 65 65 20 65 65 65 65 20 65 eee e ee eeee e
+| 3392: 65 20 65 65 65 24 a5 20 65 65 20 65 65 65 20 65 e eee$. ee eee e
+| 3408: 24 05 65 20 65 65 65 65 20 65 65 20 65 65 65 20 $.e eeee ee eee
+| 3424: 65 20 65 65 20 65 65 65 20 65 20 65 65 20 65 65 e ee eee e ee ee
+| 3440: 65 65 20 65 65 20 65 65 65 20 65 20 65 65 10 65 ee ee eee e ee.e
+| 3456: 65 65 20 65 20 65 65 20 65 65 65 65 65 65 20 65 ee e ee eeeeee e
+| 3472: 65 20 65 20 65 20 65 20 65 65 20 65 65 65 20 65 e e e e ee eee e
+| 3488: 1f 20 65 65 66 65 65 20 65 65 20 65 20 65 20 2d . eefee ee e e -
+| page 5 offset 16384
+| 4064: 00 00 00 00 05 04 d0 00 10 21 21 05 03 03 00 10 .........!!.....
+| 4080: 11 11 05 02 03 00 10 11 10 05 01 03 00 10 09 09 ................
+| page 6 offset 20480
+| 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................
+| 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version.
+| end sql022250.txt.db
+}]} {}
+
+do_catchsql_test 70.1 {
+ SELECT snippet(ttt, -1, '', '','','>')FROM ttt('e* NOT ee*e* NOT ee*');
+} {1 {database disk image is malformed}}
+
+do_catchsql_test 70.2 {
+ SELECT snippet(ttt, -1, '', '','',13)FROM ttt('e* NOT ee*e* NOT ee*')
+} {1 {database disk image is malformed}}
+
sqlite3_fts5_may_be_corrupt 0
finish_test
diff --git a/manifest b/manifest
index eced676a27..d9ff67a410 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Earlier\sdetection\sof\scorruption\sin\sthe\srtreecheck()\sSQL\sfunction\sto\sprevent\na\s(harmless)\sread\sof\san\suninitialized\svalue.
-D 2020-09-17T11:56:04.753
+C Fix\sa\s"jump\sdepends\son\sunitialized\svalue"\svalgrind/asan\serror\sin\sfts5.
+D 2020-09-17T14:16:02.879
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -118,7 +118,7 @@ F ext/fts5/fts5_buffer.c 5a5fe0159752c0fb0a5a93c722e9db2662822709490769d482b76a6
F ext/fts5/fts5_config.c b447948f35ad3354e8fe5e242e0a7e7b5b941555400b9404259944e3aa570037
F ext/fts5/fts5_expr.c b7b28ed203a3140f2fc503507d2c614a6cf1bd2e8987497f8894abc3f1477ec4
F ext/fts5/fts5_hash.c 1cc0095646f5f3b46721aa112fb4f9bf29ae175cb5338f89dcec66ed97acfe75
-F ext/fts5/fts5_index.c de14c9a30f45e2b847ff9284b14776d9d07961e545e8f1546a6aa3f915af721f
+F ext/fts5/fts5_index.c 203a8db4c35923f584e1a79cb43aa389710db6fb3ace72aad476e15b4dbd7b3e
F ext/fts5/fts5_main.c e881a2ea0bf01b3a3ff0bc1b31373c58fd54b6c9f3c43ea3d431bea4e5d4025e
F ext/fts5/fts5_storage.c 34774cac00302fee7c6ffe05e12ec38f90777fb1681245538c97357cf5eb5d0e
F ext/fts5/fts5_tcl.c 39bcbae507f594aad778172fa914cad0f585bf92fd3b078c686e249282db0d95
@@ -159,7 +159,7 @@ F ext/fts5/test/fts5connect.test 08030168fc96fc278fa81f28654fb7e90566f33aff269c0
F ext/fts5/test/fts5content.test 213506436fb2c87567b8e31f6d43ab30aab99354cec74ed679f22aad0cdbf283
F ext/fts5/test/fts5corrupt.test 77ae6f41a7eba10620efb921cf7dbe218b0ef232b04519deb43581cb17a57ebe
F ext/fts5/test/fts5corrupt2.test 7453752ba12ce91690c469a6449d412561cc604b1dec994e16ab132952e7805f
-F ext/fts5/test/fts5corrupt3.test 4f5b2f278c1ce8a03b3de77de3bd698216986cc3f6b8428075708ae9eebe0656
+F ext/fts5/test/fts5corrupt3.test b8d4d6f167b8189999dac7162ddec614ab9dca4fe5e9dcfd315e383a5e15444b
F ext/fts5/test/fts5corrupt4.test ea805c4d7c68b5f185b9db5d2060a7ae5875339738dd48203c92162f41e7ca91
F ext/fts5/test/fts5delete.test 4a15fb03b6c7eac62ac807a3a32b7f0dc74f0d479c410e3e3568ae96b9469290
F ext/fts5/test/fts5detail.test 31b240dbf6d44ac3507e2f8b65f29fdc12465ffd531212378c7ce1066766f54e
@@ -1880,7 +1880,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 751fe4edb2d4602e652523c2759de3f4fffd29d5c66cae68caf45b30fd8b750a
-R 46006fc1e92c35a627434427e02a14ec
-U drh
-Z 71d35069d355b0f119ebbc1395c98fe2
+P e2074b24788149562b15022ccd2784d6649f08ebc41410e3bfb2401baf0892e2
+R bd8ccc85abca0add0ad4396bb891f5d8
+U dan
+Z ca21c240461161621919580474841b3f
diff --git a/manifest.uuid b/manifest.uuid
index 3dd2d87f5d..89eb9b7108 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-e2074b24788149562b15022ccd2784d6649f08ebc41410e3bfb2401baf0892e2
\ No newline at end of file
+66f94d623c16b4527e42f0519e32ec78eaf9ee6fd61ee7d0eb657cc59a8f7d68
\ No newline at end of file
From f2e151aeab6944f057a6a96a3d59cbcc85dc6f50 Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 17 Sep 2020 15:16:50 +0000
Subject: [PATCH 067/169] Fix a problem in fts5 causing the in-memory hash
table to be flushed more often than necessary.
FossilOrigin-Name: 9a55601d072bcd1ac0f6f1633216c7c8b3ff3e037451e2cfd285cbe19b60b9fc
---
ext/fts5/fts5_hash.c | 1 -
ext/fts5/test/fts5hash.test | 39 ++++++++++++++++++++++++++++++++++++-
manifest | 14 ++++++-------
manifest.uuid | 2 +-
4 files changed, 46 insertions(+), 10 deletions(-)
diff --git a/ext/fts5/fts5_hash.c b/ext/fts5/fts5_hash.c
index 1a32dcdf0f..02ae0495e1 100644
--- a/ext/fts5/fts5_hash.c
+++ b/ext/fts5/fts5_hash.c
@@ -306,7 +306,6 @@ int sqlite3Fts5HashWrite(
p->iCol = (pHash->eDetail==FTS5_DETAIL_FULL ? 0 : -1);
}
- nIncr += p->nData;
}else{
/* Appending to an existing hash-entry. Check that there is enough
diff --git a/ext/fts5/test/fts5hash.test b/ext/fts5/test/fts5hash.test
index 38257db435..5df55f226f 100644
--- a/ext/fts5/test/fts5hash.test
+++ b/ext/fts5/test/fts5hash.test
@@ -112,7 +112,7 @@ foreach_detail_mode $testprefix {
# Add a small and very large token with the same hash value to an
# empty table. At one point this would provoke an asan error.
#
- do_test 2.0 {
+ do_test 1.5 {
set big [string repeat 12345 40]
set hash [sqlite3_fts5_token_hash 1024 $big]
while {1} {
@@ -128,4 +128,41 @@ foreach_detail_mode $testprefix {
} ;# foreach_detail_mode
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 2.1 {
+ CREATE VIRTUAL TABLE t1 USING fts5(x);
+ INSERT INTO t1(t1, rank) VALUES('hashsize', 1024);
+ INSERT INTO t1(t1, rank) VALUES('automerge', 0);
+ INSERT INTO t1(t1, rank) VALUES('crisismerge', 1000);
+}
+
+do_execsql_test 2.2 {
+ BEGIN;
+ INSERT INTO t1 VALUES('abc def ghi');
+ SELECT count(*) FROM t1_data;
+} {2}
+
+do_execsql_test 2.3 {
+ WITH s(i) AS (
+ SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1024
+ )
+ INSERT INTO t1 SELECT 'abc def ghi' FROM s;
+ SELECT (SELECT count(*) FROM t1_data) > 10;
+} {1}
+
+do_execsql_test 2.4 {
+ COMMIT;
+ DROP TABLE t1;
+ CREATE VIRTUAL TABLE t1 USING fts5(x);
+ INSERT INTO t1(t1, rank) VALUES('hashsize', 1024);
+ INSERT INTO t1(t1, rank) VALUES('automerge', 0);
+ INSERT INTO t1(t1, rank) VALUES('crisismerge', 1000);
+ WITH s(i) AS (
+ SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1024
+ )
+ INSERT INTO t1 SELECT 'abc' || i || ' def' || i || ' ghi' || i FROM s;
+ SELECT (SELECT count(*) FROM t1_data) > 100;
+} {1}
+
finish_test
diff --git a/manifest b/manifest
index d9ff67a410..bd54c1e943 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\s"jump\sdepends\son\sunitialized\svalue"\svalgrind/asan\serror\sin\sfts5.
-D 2020-09-17T14:16:02.879
+C Fix\sa\sproblem\sin\sfts5\scausing\sthe\sin-memory\shash\stable\sto\sbe\sflushed\smore\soften\sthan\snecessary.
+D 2020-09-17T15:16:50.739
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -117,7 +117,7 @@ F ext/fts5/fts5_aux.c dcc627d8b6e3fc773db528ff67b39955dab7b51628f9dba8e15849e5be
F ext/fts5/fts5_buffer.c 5a5fe0159752c0fb0a5a93c722e9db2662822709490769d482b76a6dc8aaca70
F ext/fts5/fts5_config.c b447948f35ad3354e8fe5e242e0a7e7b5b941555400b9404259944e3aa570037
F ext/fts5/fts5_expr.c b7b28ed203a3140f2fc503507d2c614a6cf1bd2e8987497f8894abc3f1477ec4
-F ext/fts5/fts5_hash.c 1cc0095646f5f3b46721aa112fb4f9bf29ae175cb5338f89dcec66ed97acfe75
+F ext/fts5/fts5_hash.c 15bffa734fbdca013b2289c6f8827a3b935ef14bd4dde5837d31a75434c00627
F ext/fts5/fts5_index.c 203a8db4c35923f584e1a79cb43aa389710db6fb3ace72aad476e15b4dbd7b3e
F ext/fts5/fts5_main.c e881a2ea0bf01b3a3ff0bc1b31373c58fd54b6c9f3c43ea3d431bea4e5d4025e
F ext/fts5/fts5_storage.c 34774cac00302fee7c6ffe05e12ec38f90777fb1681245538c97357cf5eb5d0e
@@ -183,7 +183,7 @@ F ext/fts5/test/fts5faultD.test cc5d1225556e356615e719c612e845d41bff7d5a
F ext/fts5/test/fts5first.test 3fcf2365c00a15fc9704233674789a3b95131d12de18a9b996159f6909dc8079
F ext/fts5/test/fts5full.test e1701a112354e0ff9a1fdffb0c940c576530c33732ee20ac5e8361777070d717
F ext/fts5/test/fts5fuzz1.test 238d8c45f3b81342aa384de3e581ff2fa330bf922a7b69e484bbc06051a1080e
-F ext/fts5/test/fts5hash.test a4cf51acad99bfc43c16fb74f9d22495dc221ae0701fc5e908ca963a9b26a02b
+F ext/fts5/test/fts5hash.test dc7bc7e0cdeb42cfce31294ad2f8fcf43192bfd0145bb7f3ecc5465d8c72696f
F ext/fts5/test/fts5integrity.test 8ffabcd91b058d812aba3e3e0a06f76ce165ba402a18cca20e34204a7feec92e
F ext/fts5/test/fts5interrupt.test 09613247b273a99889808ef852898177e671406fe71fdde7ea00e78ea283d227
F ext/fts5/test/fts5lastrowid.test be98fe3e03235296585b72daad7aed5717ba0062bae5e5c18dd6e04e194c6b28
@@ -1880,7 +1880,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 e2074b24788149562b15022ccd2784d6649f08ebc41410e3bfb2401baf0892e2
-R bd8ccc85abca0add0ad4396bb891f5d8
+P 66f94d623c16b4527e42f0519e32ec78eaf9ee6fd61ee7d0eb657cc59a8f7d68
+R e41c17b4bed44058d505cf6f4e0a49a6
U dan
-Z ca21c240461161621919580474841b3f
+Z a006919448d0027496c11de5dc510a38
diff --git a/manifest.uuid b/manifest.uuid
index 89eb9b7108..02c27d1517 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-66f94d623c16b4527e42f0519e32ec78eaf9ee6fd61ee7d0eb657cc59a8f7d68
\ No newline at end of file
+9a55601d072bcd1ac0f6f1633216c7c8b3ff3e037451e2cfd285cbe19b60b9fc
\ No newline at end of file
From 39c7125a97bedcfa152aef8451dd2e6d258b6508 Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 17 Sep 2020 17:01:16 +0000
Subject: [PATCH 068/169] Fix a problem in sqlite-expert causing it to ignore
equality constraints on the second or subsequent columns of a multi-column
PRIMARY KEY.
FossilOrigin-Name: c666c85a433fbc83edef4dbfb0399672e570f5d7979ab61cb39ff5488595d822
---
ext/expert/expert1.test | 41 ++++++++++++++++++++++++++++++++++++++
ext/expert/sqlite3expert.c | 4 +++-
manifest | 14 ++++++-------
manifest.uuid | 2 +-
4 files changed, 52 insertions(+), 9 deletions(-)
diff --git a/ext/expert/expert1.test b/ext/expert/expert1.test
index 3e5d604d52..f49f1f5e5c 100644
--- a/ext/expert/expert1.test
+++ b/ext/expert/expert1.test
@@ -326,6 +326,47 @@ do_setup_rec_test $tn.16 {
SCAN TABLE t1
}
+do_setup_rec_test $tn.17.1 {
+ CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
+} {
+ SELECT * FROM example WHERE a=?
+} {
+ (no new indexes)
+ SEARCH TABLE example USING INDEX sqlite_autoindex_example_1 (A=?)
+}
+do_setup_rec_test $tn.17.2 {
+ CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
+} {
+ SELECT * FROM example WHERE b=?
+} {
+ CREATE INDEX example_idx_00000042 ON example(B);
+ SEARCH TABLE example USING INDEX example_idx_00000042 (B=?)
+}
+do_setup_rec_test $tn.17.3 {
+ CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
+} {
+ SELECT * FROM example WHERE a=? AND b=?
+} {
+ (no new indexes)
+ SEARCH TABLE example USING INDEX sqlite_autoindex_example_1 (A=? AND B=?)
+}
+do_setup_rec_test $tn.17.4 {
+ CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
+} {
+ SELECT * FROM example WHERE a=? AND b>?
+} {
+ (no new indexes)
+ SEARCH TABLE example USING INDEX sqlite_autoindex_example_1 (A=? AND B>?)
+}
+do_setup_rec_test $tn.17.5 {
+ CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
+} {
+ SELECT * FROM example WHERE a>? AND b=?
+} {
+ CREATE INDEX example_idx_0000cb3f ON example(B, A);
+ SEARCH TABLE example USING INDEX example_idx_0000cb3f (B=? AND A>?)
+}
+
}
proc do_candidates_test {tn sql res} {
diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c
index 1dd0700893..c2a6fe3ba9 100644
--- a/ext/expert/sqlite3expert.c
+++ b/ext/expert/sqlite3expert.c
@@ -685,6 +685,7 @@ static int idxGetTableInfo(
IdxTable *pNew = 0;
int rc, rc2;
char *pCsr = 0;
+ int nPk = 0;
rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_info=%Q", zTab);
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
@@ -695,6 +696,7 @@ static int idxGetTableInfo(
);
nByte += 1 + STRLEN(zCol);
nCol++;
+ nPk += (sqlite3_column_int(p1, 5)>0);
}
rc2 = sqlite3_reset(p1);
if( rc==SQLITE_OK ) rc = rc2;
@@ -714,7 +716,7 @@ static int idxGetTableInfo(
const char *zCol = (const char*)sqlite3_column_text(p1, 1);
int nCopy = STRLEN(zCol) + 1;
pNew->aCol[nCol].zName = pCsr;
- pNew->aCol[nCol].iPk = sqlite3_column_int(p1, 5);
+ pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1);
memcpy(pCsr, zCol, nCopy);
pCsr += nCopy;
diff --git a/manifest b/manifest
index bd54c1e943..b67dac1095 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\sin\sfts5\scausing\sthe\sin-memory\shash\stable\sto\sbe\sflushed\smore\soften\sthan\snecessary.
-D 2020-09-17T15:16:50.739
+C Fix\sa\sproblem\sin\ssqlite-expert\scausing\sit\sto\signore\sequality\sconstraints\son\sthe\ssecond\sor\ssubsequent\scolumns\sof\sa\smulti-column\sPRIMARY\sKEY.
+D 2020-09-17T17:01:16.712
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -49,8 +49,8 @@ F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad
F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
-F ext/expert/expert1.test 2e10ff875c31c9e6fc5e324767624181273859771fe34c5daeeadf3f2974a4f7
-F ext/expert/sqlite3expert.c b5eae75862d34a204d16c45dcb813888b5f86bdc156c6136b0f79094c0da4f79
+F ext/expert/expert1.test dba6e752cc701621771f925f3872b183fa688f7b4a9f4822631fc02bdbffc45a
+F ext/expert/sqlite3expert.c 2778d9f06b3a8bfa859cb6b75b82f004477bf5dd78edd17d954319750ca963f3
F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b
F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
@@ -1880,7 +1880,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 66f94d623c16b4527e42f0519e32ec78eaf9ee6fd61ee7d0eb657cc59a8f7d68
-R e41c17b4bed44058d505cf6f4e0a49a6
+P 9a55601d072bcd1ac0f6f1633216c7c8b3ff3e037451e2cfd285cbe19b60b9fc
+R 1b8ed3298f0ba2961d745b725529ab90
U dan
-Z a006919448d0027496c11de5dc510a38
+Z 77444fb656cbd43553b87fd41a98a8c8
diff --git a/manifest.uuid b/manifest.uuid
index 02c27d1517..f3a1fb2a8a 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-9a55601d072bcd1ac0f6f1633216c7c8b3ff3e037451e2cfd285cbe19b60b9fc
\ No newline at end of file
+c666c85a433fbc83edef4dbfb0399672e570f5d7979ab61cb39ff5488595d822
\ No newline at end of file
From 68cffa65fba2f59d91e1da582e2a0b0fa7a4211a Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 17 Sep 2020 21:11:25 +0000
Subject: [PATCH 069/169] Fix a typo in the documentation comment for
sqlite3_preupdate_hook().
FossilOrigin-Name: 4542d194e2fef5e21e1c3679914bd9e21fab31cfb111cf640524fb3514a8afa3
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/sqlite.h.in | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index b67dac1095..7a7c93c143 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\sin\ssqlite-expert\scausing\sit\sto\signore\sequality\sconstraints\son\sthe\ssecond\sor\ssubsequent\scolumns\sof\sa\smulti-column\sPRIMARY\sKEY.
-D 2020-09-17T17:01:16.712
+C Fix\sa\stypo\sin\sthe\sdocumentation\scomment\sfor\ssqlite3_preupdate_hook().
+D 2020-09-17T21:11:25.177
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -537,7 +537,7 @@ F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 6c3f7d60295f06ce7fa128bb23b1159648f0aa96a78c257af35dfef727ac63f1
F src/shell.c.in 0fd9eca42731d94a293d7b12a76c6614976f8bdbb2874768ad2e6ddbb86dffd8
-F src/sqlite.h.in 11896ccb28f85b0aa52f0d4169aaca0ed7cf3f9b3e0c544aecee0032ae2b3c2e
+F src/sqlite.h.in cb9f0862e8d0f8691de95b18439ab60666f868c83bc65e3a17f0a0b44cc8f8a9
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
F src/sqliteInt.h 34319c13e900063b267052168b277c7bc1e124a1ceef457e450d53ce618bb96e
@@ -1880,7 +1880,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 9a55601d072bcd1ac0f6f1633216c7c8b3ff3e037451e2cfd285cbe19b60b9fc
-R 1b8ed3298f0ba2961d745b725529ab90
+P c666c85a433fbc83edef4dbfb0399672e570f5d7979ab61cb39ff5488595d822
+R e4b1233394b3f971fe6857532e618b21
U dan
-Z 77444fb656cbd43553b87fd41a98a8c8
+Z b4f246e815a6b5019523f3bd510ab2ce
diff --git a/manifest.uuid b/manifest.uuid
index f3a1fb2a8a..a591dd9ce2 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-c666c85a433fbc83edef4dbfb0399672e570f5d7979ab61cb39ff5488595d822
\ No newline at end of file
+4542d194e2fef5e21e1c3679914bd9e21fab31cfb111cf640524fb3514a8afa3
\ No newline at end of file
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index be940e0197..1ea1f43224 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -9471,7 +9471,7 @@ int sqlite3_db_cacheflush(sqlite3*);
** seventh parameter is the final rowid value of the row being inserted
** or updated. The value of the seventh parameter passed to the callback
** function is not defined for operations on WITHOUT ROWID tables, or for
-** INSERT operations on rowid tables.
+** DELETE operations on rowid tables.
**
** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
From 79d9af960b39c02be348b68b14f4a8736137a0e3 Mon Sep 17 00:00:00 2001
From: drh
Date: Sun, 20 Sep 2020 12:10:28 +0000
Subject: [PATCH 070/169] Attempt to silence harmless static analyzer warnings
in Lemon and in the Lemon-generated parser.
FossilOrigin-Name: de8ce22a46c90afa5475cd24c28b7a82b26410dc72d662af2f9d9e5e528e0eec
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
tool/lemon.c | 13 +++++++------
tool/lempar.c | 4 +++-
4 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/manifest b/manifest
index 7a7c93c143..dcc766b964 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\stypo\sin\sthe\sdocumentation\scomment\sfor\ssqlite3_preupdate_hook().
-D 2020-09-17T21:11:25.177
+C Attempt\sto\ssilence\sharmless\sstatic\sanalyzer\swarnings\sin\sLemon\sand\sin\sthe\nLemon-generated\sparser.
+D 2020-09-20T12:10:28.961
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1799,8 +1799,8 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c 28a0641683fa8786dd52d401f2b99727a0137832ebe97d822de6a493fe658abc
-F tool/lempar.c 70243f14640759cb1a8f048024daa5e54505e80e79ec02bc979edfd1a7c5e810
+F tool/lemon.c a20eb41b9acd452211e10e769d7b679db0b023e2f1722bcd571c7142353ba812
+F tool/lempar.c 3de93047419c03240e680ab4d47f15aabb136e728540a07efbe9eee867fa4b31
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
@@ -1880,7 +1880,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 c666c85a433fbc83edef4dbfb0399672e570f5d7979ab61cb39ff5488595d822
-R e4b1233394b3f971fe6857532e618b21
-U dan
-Z b4f246e815a6b5019523f3bd510ab2ce
+P 4542d194e2fef5e21e1c3679914bd9e21fab31cfb111cf640524fb3514a8afa3
+R 124e67bad8553faf5aee7db449f4027c
+U drh
+Z f070be8086929fecf605cec35180f31a
diff --git a/manifest.uuid b/manifest.uuid
index a591dd9ce2..c8292e44a1 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-4542d194e2fef5e21e1c3679914bd9e21fab31cfb111cf640524fb3514a8afa3
\ No newline at end of file
+de8ce22a46c90afa5475cd24c28b7a82b26410dc72d662af2f9d9e5e528e0eec
\ No newline at end of file
diff --git a/tool/lemon.c b/tool/lemon.c
index 82531362e7..a2796c94f2 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -1598,7 +1598,7 @@ static struct rule *Rule_sort(struct rule *rp){
while( rp ){
pNext = rp->next;
rp->next = 0;
- for(i=0; iargv0,templatename,0);
+ toFree = tpltname = pathsearch(lemp->argv0,templatename,0);
}
if( tpltname==0 ){
fprintf(stderr,"Can't find the parser driver template file \"%s\".\n",
@@ -3678,10 +3679,10 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
}
in = fopen(tpltname,"rb");
if( in==0 ){
- fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
+ fprintf(stderr,"Can't open the template file \"%s\".\n",tpltname);
lemp->errorcnt++;
- return 0;
}
+ free(toFree);
return in;
}
diff --git a/tool/lempar.c b/tool/lempar.c
index 079635b21f..9a48548574 100644
--- a/tool/lempar.c
+++ b/tool/lempar.c
@@ -718,8 +718,10 @@ static YYACTIONTYPE yy_reduce(
(void)yyLookahead;
(void)yyLookaheadToken;
yymsp = yypParser->yytos;
+ assert( yyruleno>=0 );
+ assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
#ifndef NDEBUG
- if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
+ if( yyTraceFILE ){
yysize = yyRuleInfoNRhs[yyruleno];
if( yysize ){
fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
From 9ca41fbfa93abb7f1e19790010cd270b0aa3870c Mon Sep 17 00:00:00 2001
From: drh
Date: Sun, 20 Sep 2020 13:33:28 +0000
Subject: [PATCH 071/169] Remove a new assert() that the compiler finds is
always true at compile-time, to avoid a compiler warning.
FossilOrigin-Name: 8bbaee238593741da107b92b254cb5f0cf8b6bcc760bf2b25d20e46c8edee2a9
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
tool/lempar.c | 1 -
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index dcc766b964..2f0a000603 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Attempt\sto\ssilence\sharmless\sstatic\sanalyzer\swarnings\sin\sLemon\sand\sin\sthe\nLemon-generated\sparser.
-D 2020-09-20T12:10:28.961
+C Remove\sa\snew\sassert()\sthat\sthe\scompiler\sfinds\sis\salways\strue\sat\scompile-time,\nto\savoid\sa\scompiler\swarning.
+D 2020-09-20T13:33:28.653
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1800,7 +1800,7 @@ F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
F tool/lemon.c a20eb41b9acd452211e10e769d7b679db0b023e2f1722bcd571c7142353ba812
-F tool/lempar.c 3de93047419c03240e680ab4d47f15aabb136e728540a07efbe9eee867fa4b31
+F tool/lempar.c 0e1d5eeb9736108d3dba782a9dd56f4e7cb69006b6ee181308b7ebfb15313a12
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
@@ -1880,7 +1880,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 4542d194e2fef5e21e1c3679914bd9e21fab31cfb111cf640524fb3514a8afa3
-R 124e67bad8553faf5aee7db449f4027c
+P de8ce22a46c90afa5475cd24c28b7a82b26410dc72d662af2f9d9e5e528e0eec
+R 0b8e09249869856bd234668560922f9f
U drh
-Z f070be8086929fecf605cec35180f31a
+Z 1341315cc82b02a68b29a94b0a5ab754
diff --git a/manifest.uuid b/manifest.uuid
index c8292e44a1..40243a1748 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-de8ce22a46c90afa5475cd24c28b7a82b26410dc72d662af2f9d9e5e528e0eec
\ No newline at end of file
+8bbaee238593741da107b92b254cb5f0cf8b6bcc760bf2b25d20e46c8edee2a9
\ No newline at end of file
diff --git a/tool/lempar.c b/tool/lempar.c
index 9a48548574..71a51cf448 100644
--- a/tool/lempar.c
+++ b/tool/lempar.c
@@ -718,7 +718,6 @@ static YYACTIONTYPE yy_reduce(
(void)yyLookahead;
(void)yyLookaheadToken;
yymsp = yypParser->yytos;
- assert( yyruleno>=0 );
assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
#ifndef NDEBUG
if( yyTraceFILE ){
From 7548ab20e631e4b6585e6016a79cd5abbb938d7e Mon Sep 17 00:00:00 2001
From: dan
Date: Mon, 21 Sep 2020 14:53:21 +0000
Subject: [PATCH 072/169] In fts5 integrity checks, do not compare the contents
of the index against an external content table unless specifically requested.
FossilOrigin-Name: 782163693f37aeb65209bebbaeb6659a36881b8c4b4bec778b366658488bf966
---
ext/fts5/fts5Int.h | 4 +-
ext/fts5/fts5_index.c | 4 +-
ext/fts5/fts5_main.c | 3 +-
ext/fts5/fts5_storage.c | 134 ++++++++++++++++---------------
ext/fts5/test/fts5integrity.test | 37 ++++++++-
manifest | 22 ++---
manifest.uuid | 2 +-
7 files changed, 124 insertions(+), 82 deletions(-)
diff --git a/ext/fts5/fts5Int.h b/ext/fts5/fts5Int.h
index e0287d1616..364a5c6de8 100644
--- a/ext/fts5/fts5Int.h
+++ b/ext/fts5/fts5Int.h
@@ -484,7 +484,7 @@ int sqlite3Fts5IndexSetAverages(Fts5Index *p, const u8*, int);
/*
** Functions called by the storage module as part of integrity-check.
*/
-int sqlite3Fts5IndexIntegrityCheck(Fts5Index*, u64 cksum);
+int sqlite3Fts5IndexIntegrityCheck(Fts5Index*, u64 cksum, int bUseCksum);
/*
** Called during virtual module initialization to register UDF
@@ -639,7 +639,7 @@ int sqlite3Fts5StorageDelete(Fts5Storage *p, i64, sqlite3_value**);
int sqlite3Fts5StorageContentInsert(Fts5Storage *p, sqlite3_value**, i64*);
int sqlite3Fts5StorageIndexInsert(Fts5Storage *p, sqlite3_value**, i64);
-int sqlite3Fts5StorageIntegrity(Fts5Storage *p);
+int sqlite3Fts5StorageIntegrity(Fts5Storage *p, int iArg);
int sqlite3Fts5StorageStmt(Fts5Storage *p, int eStmt, sqlite3_stmt**, char**);
void sqlite3Fts5StorageStmtRelease(Fts5Storage *p, int eStmt, sqlite3_stmt*);
diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c
index d923a9d9df..7830dd52c3 100644
--- a/ext/fts5/fts5_index.c
+++ b/ext/fts5/fts5_index.c
@@ -6062,7 +6062,7 @@ static void fts5IndexIntegrityCheckSegment(
** error, or some other SQLite error code if another error (e.g. OOM)
** occurs.
*/
-int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum){
+int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum, int bUseCksum){
int eDetail = p->pConfig->eDetail;
u64 cksum2 = 0; /* Checksum based on contents of indexes */
Fts5Buffer poslist = {0,0,0}; /* Buffer used to hold a poslist */
@@ -6133,7 +6133,7 @@ int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum){
fts5TestTerm(p, &term, 0, 0, cksum2, &cksum3);
fts5MultiIterFree(pIter);
- if( p->rc==SQLITE_OK && cksum!=cksum2 ) p->rc = FTS5_CORRUPT;
+ if( p->rc==SQLITE_OK && bUseCksum && cksum!=cksum2 ) p->rc = FTS5_CORRUPT;
fts5StructureRelease(pStruct);
#ifdef SQLITE_DEBUG
diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c
index 347bf7f23e..80901de078 100644
--- a/ext/fts5/fts5_main.c
+++ b/ext/fts5/fts5_main.c
@@ -1508,7 +1508,8 @@ static int fts5SpecialInsert(
int nMerge = sqlite3_value_int(pVal);
rc = sqlite3Fts5StorageMerge(pTab->pStorage, nMerge);
}else if( 0==sqlite3_stricmp("integrity-check", zCmd) ){
- rc = sqlite3Fts5StorageIntegrity(pTab->pStorage);
+ int iArg = sqlite3_value_int(pVal);
+ rc = sqlite3Fts5StorageIntegrity(pTab->pStorage, iArg);
#ifdef SQLITE_DEBUG
}else if( 0==sqlite3_stricmp("prefix-index", zCmd) ){
pConfig->bPrefixIndex = sqlite3_value_int(pVal);
diff --git a/ext/fts5/fts5_storage.c b/ext/fts5/fts5_storage.c
index a33bbf6012..c5052b0478 100644
--- a/ext/fts5/fts5_storage.c
+++ b/ext/fts5/fts5_storage.c
@@ -881,13 +881,14 @@ static int fts5StorageIntegrityCallback(
** some other SQLite error code if an error occurs while attempting to
** determine this.
*/
-int sqlite3Fts5StorageIntegrity(Fts5Storage *p){
+int sqlite3Fts5StorageIntegrity(Fts5Storage *p, int iArg){
Fts5Config *pConfig = p->pConfig;
- int rc; /* Return code */
+ int rc = SQLITE_OK; /* Return code */
int *aColSize; /* Array of size pConfig->nCol */
i64 *aTotalSize; /* Array of size pConfig->nCol */
Fts5IntegrityCtx ctx;
sqlite3_stmt *pScan;
+ int bUseCksum;
memset(&ctx, 0, sizeof(Fts5IntegrityCtx));
ctx.pConfig = p->pConfig;
@@ -896,83 +897,88 @@ int sqlite3Fts5StorageIntegrity(Fts5Storage *p){
aColSize = (int*)&aTotalSize[pConfig->nCol];
memset(aTotalSize, 0, sizeof(i64) * pConfig->nCol);
- /* Generate the expected index checksum based on the contents of the
- ** %_content table. This block stores the checksum in ctx.cksum. */
- rc = fts5StorageGetStmt(p, FTS5_STMT_SCAN, &pScan, 0);
- if( rc==SQLITE_OK ){
- int rc2;
- while( SQLITE_ROW==sqlite3_step(pScan) ){
- int i;
- ctx.iRowid = sqlite3_column_int64(pScan, 0);
- ctx.szCol = 0;
- if( pConfig->bColumnsize ){
- rc = sqlite3Fts5StorageDocsize(p, ctx.iRowid, aColSize);
- }
- if( rc==SQLITE_OK && pConfig->eDetail==FTS5_DETAIL_NONE ){
- rc = sqlite3Fts5TermsetNew(&ctx.pTermset);
- }
- for(i=0; rc==SQLITE_OK && inCol; i++){
- if( pConfig->abUnindexed[i] ) continue;
- ctx.iCol = i;
+ bUseCksum = (pConfig->eContent==FTS5_CONTENT_NORMAL
+ || (pConfig->eContent==FTS5_CONTENT_EXTERNAL && iArg)
+ );
+ if( bUseCksum ){
+ /* Generate the expected index checksum based on the contents of the
+ ** %_content table. This block stores the checksum in ctx.cksum. */
+ rc = fts5StorageGetStmt(p, FTS5_STMT_SCAN, &pScan, 0);
+ if( rc==SQLITE_OK ){
+ int rc2;
+ while( SQLITE_ROW==sqlite3_step(pScan) ){
+ int i;
+ ctx.iRowid = sqlite3_column_int64(pScan, 0);
ctx.szCol = 0;
- if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
+ if( pConfig->bColumnsize ){
+ rc = sqlite3Fts5StorageDocsize(p, ctx.iRowid, aColSize);
+ }
+ if( rc==SQLITE_OK && pConfig->eDetail==FTS5_DETAIL_NONE ){
rc = sqlite3Fts5TermsetNew(&ctx.pTermset);
}
- if( rc==SQLITE_OK ){
- const char *zText = (const char*)sqlite3_column_text(pScan, i+1);
- int nText = sqlite3_column_bytes(pScan, i+1);
- rc = sqlite3Fts5Tokenize(pConfig,
- FTS5_TOKENIZE_DOCUMENT,
- zText, nText,
- (void*)&ctx,
- fts5StorageIntegrityCallback
- );
- }
- if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){
- rc = FTS5_CORRUPT;
- }
- aTotalSize[i] += ctx.szCol;
- if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
- sqlite3Fts5TermsetFree(ctx.pTermset);
- ctx.pTermset = 0;
+ for(i=0; rc==SQLITE_OK && inCol; i++){
+ if( pConfig->abUnindexed[i] ) continue;
+ ctx.iCol = i;
+ ctx.szCol = 0;
+ if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
+ rc = sqlite3Fts5TermsetNew(&ctx.pTermset);
+ }
+ if( rc==SQLITE_OK ){
+ const char *zText = (const char*)sqlite3_column_text(pScan, i+1);
+ int nText = sqlite3_column_bytes(pScan, i+1);
+ rc = sqlite3Fts5Tokenize(pConfig,
+ FTS5_TOKENIZE_DOCUMENT,
+ zText, nText,
+ (void*)&ctx,
+ fts5StorageIntegrityCallback
+ );
+ }
+ if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){
+ rc = FTS5_CORRUPT;
+ }
+ aTotalSize[i] += ctx.szCol;
+ if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
+ sqlite3Fts5TermsetFree(ctx.pTermset);
+ ctx.pTermset = 0;
+ }
}
+ sqlite3Fts5TermsetFree(ctx.pTermset);
+ ctx.pTermset = 0;
+
+ if( rc!=SQLITE_OK ) break;
}
- sqlite3Fts5TermsetFree(ctx.pTermset);
- ctx.pTermset = 0;
-
- if( rc!=SQLITE_OK ) break;
+ rc2 = sqlite3_reset(pScan);
+ if( rc==SQLITE_OK ) rc = rc2;
}
- rc2 = sqlite3_reset(pScan);
- if( rc==SQLITE_OK ) rc = rc2;
- }
- /* Test that the "totals" (sometimes called "averages") record looks Ok */
- if( rc==SQLITE_OK ){
- int i;
- rc = fts5StorageLoadTotals(p, 0);
- for(i=0; rc==SQLITE_OK && inCol; i++){
- if( p->aTotalSize[i]!=aTotalSize[i] ) rc = FTS5_CORRUPT;
+ /* Test that the "totals" (sometimes called "averages") record looks Ok */
+ if( rc==SQLITE_OK ){
+ int i;
+ rc = fts5StorageLoadTotals(p, 0);
+ for(i=0; rc==SQLITE_OK && inCol; i++){
+ if( p->aTotalSize[i]!=aTotalSize[i] ) rc = FTS5_CORRUPT;
+ }
}
- }
- /* Check that the %_docsize and %_content tables contain the expected
- ** number of rows. */
- if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){
- i64 nRow = 0;
- rc = fts5StorageCount(p, "content", &nRow);
- if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;
- }
- if( rc==SQLITE_OK && pConfig->bColumnsize ){
- i64 nRow = 0;
- rc = fts5StorageCount(p, "docsize", &nRow);
- if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;
+ /* Check that the %_docsize and %_content tables contain the expected
+ ** number of rows. */
+ if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){
+ i64 nRow = 0;
+ rc = fts5StorageCount(p, "content", &nRow);
+ if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;
+ }
+ if( rc==SQLITE_OK && pConfig->bColumnsize ){
+ i64 nRow = 0;
+ rc = fts5StorageCount(p, "docsize", &nRow);
+ if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;
+ }
}
/* Pass the expected checksum down to the FTS index module. It will
** verify, amongst other things, that it matches the checksum generated by
** inspecting the index itself. */
if( rc==SQLITE_OK ){
- rc = sqlite3Fts5IndexIntegrityCheck(p->pIndex, ctx.cksum);
+ rc = sqlite3Fts5IndexIntegrityCheck(p->pIndex, ctx.cksum, bUseCksum);
}
sqlite3_free(aTotalSize);
diff --git a/ext/fts5/test/fts5integrity.test b/ext/fts5/test/fts5integrity.test
index 38dff21f79..d922ad3b86 100644
--- a/ext/fts5/test/fts5integrity.test
+++ b/ext/fts5/test/fts5integrity.test
@@ -273,7 +273,6 @@ do_execsql_test 9.1.2 {
SELECT quote(x'37');
} {X'37'}
-breakpoint
do_execsql_test 9.2 {
INSERT INTO vt0 VALUES (SUBSTR(x'37', 0));
-- INSERT INTO vt0 VALUES (x'37');
@@ -282,4 +281,40 @@ do_execsql_test 9.3 {
INSERT INTO vt0(vt0) VALUES('integrity-check');
}
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 10.0 {
+ CREATE TABLE t1(i INTEGER PRIMARY KEY, a, b);
+ CREATE VIRTUAL TABLE vt0 USING fts5(a, b, content=t1);
+ INSERT INTO vt0(rowid, a, b) VALUES(1, 'abc', 'def');
+}
+do_catchsql_test 10.1 {
+ INSERT INTO vt0(vt0) VALUES('integrity-check');
+} {0 {}}
+do_catchsql_test 10.2 {
+ INSERT INTO vt0(vt0, rank) VALUES('integrity-check', 0);
+} {0 {}}
+do_catchsql_test 10.3 {
+ INSERT INTO vt0(vt0, rank) VALUES('integrity-check', 1);
+} {1 {database disk image is malformed}}
+do_catchsql_test 10.3 {
+ INSERT INTO t1 VALUES(1, 'abc', 'def');
+ INSERT INTO vt0(vt0, rank) VALUES('integrity-check', 1);
+} {0 {}}
+
+do_execsql_test 10.4 {
+ CREATE VIRTUAL TABLE vt1 USING fts5(a, b, content=);
+ INSERT INTO vt1(rowid, a, b) VALUES(1, 'abc', 'def');
+}
+
+do_catchsql_test 10.5.1 {
+ INSERT INTO vt0(vt0, rank) VALUES('integrity-check', 0);
+} {0 {}}
+do_catchsql_test 10.5.2 {
+ INSERT INTO vt0(vt0, rank) VALUES('integrity-check', 1);
+} {0 {}}
+do_catchsql_test 10.5.3 {
+ INSERT INTO vt0(vt0) VALUES('integrity-check');
+} {0 {}}
+
finish_test
diff --git a/manifest b/manifest
index 2f0a000603..e92e6a2dea 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sa\snew\sassert()\sthat\sthe\scompiler\sfinds\sis\salways\strue\sat\scompile-time,\nto\savoid\sa\scompiler\swarning.
-D 2020-09-20T13:33:28.653
+C In\sfts5\sintegrity\schecks,\sdo\snot\scompare\sthe\scontents\sof\sthe\sindex\sagainst\san\sexternal\scontent\stable\sunless\sspecifically\srequested.
+D 2020-09-21T14:53:21.394
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -112,15 +112,15 @@ F ext/fts3/unicode/mkunicode.tcl bf7fcaa6d68e6d38223467983785d054f1cff4d9e3905dd
F ext/fts3/unicode/parseunicode.tcl a981bd6466d12dd17967515801c3ff23f74a281be1a03cf1e6f52a6959fc77eb
F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0
F ext/fts5/fts5.h c132a9323f22a972c4c93a8d5a3d901113a6e612faf30ca8e695788438c5ca2a
-F ext/fts5/fts5Int.h d7cbc214ee167496f70905667e18f73ea0402f7ef09236ce305e117e0efc866a
+F ext/fts5/fts5Int.h ba835c165bb87650fc806008969799a7a1fbe3e221fd5a850dd044eb6a87b243
F ext/fts5/fts5_aux.c dcc627d8b6e3fc773db528ff67b39955dab7b51628f9dba8e15849e5bedfd7fa
F ext/fts5/fts5_buffer.c 5a5fe0159752c0fb0a5a93c722e9db2662822709490769d482b76a6dc8aaca70
F ext/fts5/fts5_config.c b447948f35ad3354e8fe5e242e0a7e7b5b941555400b9404259944e3aa570037
F ext/fts5/fts5_expr.c b7b28ed203a3140f2fc503507d2c614a6cf1bd2e8987497f8894abc3f1477ec4
F ext/fts5/fts5_hash.c 15bffa734fbdca013b2289c6f8827a3b935ef14bd4dde5837d31a75434c00627
-F ext/fts5/fts5_index.c 203a8db4c35923f584e1a79cb43aa389710db6fb3ace72aad476e15b4dbd7b3e
-F ext/fts5/fts5_main.c e881a2ea0bf01b3a3ff0bc1b31373c58fd54b6c9f3c43ea3d431bea4e5d4025e
-F ext/fts5/fts5_storage.c 34774cac00302fee7c6ffe05e12ec38f90777fb1681245538c97357cf5eb5d0e
+F ext/fts5/fts5_index.c 255d3ce3fec28be11c533451e5b23bd79e71a13a1b120f3658b34fff6b097816
+F ext/fts5/fts5_main.c 30969e4e14e720e9c603e66714bd1905a63defd4492d5a16d2671398a664fcfd
+F ext/fts5/fts5_storage.c 58ba71e6cd3d43a5735815e7956ee167babb4d2cbfe206905174792af4d09d75
F ext/fts5/fts5_tcl.c 39bcbae507f594aad778172fa914cad0f585bf92fd3b078c686e249282db0d95
F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee
F ext/fts5/fts5_test_tok.c f96c6e193c466711d6d7828d5f190407fe7ab897062d371426dd3036f01258e7
@@ -184,7 +184,7 @@ F ext/fts5/test/fts5first.test 3fcf2365c00a15fc9704233674789a3b95131d12de18a9b99
F ext/fts5/test/fts5full.test e1701a112354e0ff9a1fdffb0c940c576530c33732ee20ac5e8361777070d717
F ext/fts5/test/fts5fuzz1.test 238d8c45f3b81342aa384de3e581ff2fa330bf922a7b69e484bbc06051a1080e
F ext/fts5/test/fts5hash.test dc7bc7e0cdeb42cfce31294ad2f8fcf43192bfd0145bb7f3ecc5465d8c72696f
-F ext/fts5/test/fts5integrity.test 8ffabcd91b058d812aba3e3e0a06f76ce165ba402a18cca20e34204a7feec92e
+F ext/fts5/test/fts5integrity.test e387b2bd1c83e50f4a12f58a5fd399111bbab36be2f1c9fd5bb974be08a32de6
F ext/fts5/test/fts5interrupt.test 09613247b273a99889808ef852898177e671406fe71fdde7ea00e78ea283d227
F ext/fts5/test/fts5lastrowid.test be98fe3e03235296585b72daad7aed5717ba0062bae5e5c18dd6e04e194c6b28
F ext/fts5/test/fts5leftjoin.test c0b4cafb9661379e576dc4405c0891d8fcc2782680740513c4d1fc114b43d4ad
@@ -1880,7 +1880,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 de8ce22a46c90afa5475cd24c28b7a82b26410dc72d662af2f9d9e5e528e0eec
-R 0b8e09249869856bd234668560922f9f
-U drh
-Z 1341315cc82b02a68b29a94b0a5ab754
+P 8bbaee238593741da107b92b254cb5f0cf8b6bcc760bf2b25d20e46c8edee2a9
+R 2dc50a55577b973c60140e20c804f94a
+U dan
+Z 711849bf69192b1920219728f40bdd65
diff --git a/manifest.uuid b/manifest.uuid
index 40243a1748..cf11c70ddd 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-8bbaee238593741da107b92b254cb5f0cf8b6bcc760bf2b25d20e46c8edee2a9
\ No newline at end of file
+782163693f37aeb65209bebbaeb6659a36881b8c4b4bec778b366658488bf966
\ No newline at end of file
From 273ee151217b04c640c1af148e36c518678c89fa Mon Sep 17 00:00:00 2001
From: mistachkin
Date: Mon, 21 Sep 2020 20:18:44 +0000
Subject: [PATCH 073/169] Fix harmless compiler warning seen with MSVC.
FossilOrigin-Name: 4591ee03d7a1ef3f0f6ad0629493fdb7a1c0ddb3277a9e87aa244cb0ca770593
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
tool/lemon.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index e92e6a2dea..c85dfe7603 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sfts5\sintegrity\schecks,\sdo\snot\scompare\sthe\scontents\sof\sthe\sindex\sagainst\san\sexternal\scontent\stable\sunless\sspecifically\srequested.
-D 2020-09-21T14:53:21.394
+C Fix\sharmless\scompiler\swarning\sseen\swith\sMSVC.
+D 2020-09-21T20:18:44.298
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1799,7 +1799,7 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c a20eb41b9acd452211e10e769d7b679db0b023e2f1722bcd571c7142353ba812
+F tool/lemon.c 70eedc31614a58fe31a71025c17ebd1502a6ce9cfef0ed5e33acb0b5b737b291
F tool/lempar.c 0e1d5eeb9736108d3dba782a9dd56f4e7cb69006b6ee181308b7ebfb15313a12
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
@@ -1880,7 +1880,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 8bbaee238593741da107b92b254cb5f0cf8b6bcc760bf2b25d20e46c8edee2a9
-R 2dc50a55577b973c60140e20c804f94a
-U dan
-Z 711849bf69192b1920219728f40bdd65
+P 782163693f37aeb65209bebbaeb6659a36881b8c4b4bec778b366658488bf966
+R 5af95199526128dc811fede293f15c08
+U mistachkin
+Z 03a5a4cf0703ce5a197f76e2fac51ef2
diff --git a/manifest.uuid b/manifest.uuid
index cf11c70ddd..0af6175d3b 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-782163693f37aeb65209bebbaeb6659a36881b8c4b4bec778b366658488bf966
\ No newline at end of file
+4591ee03d7a1ef3f0f6ad0629493fdb7a1c0ddb3277a9e87aa244cb0ca770593
\ No newline at end of file
diff --git a/tool/lemon.c b/tool/lemon.c
index a2796c94f2..54c8946a0d 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -3517,7 +3517,7 @@ void ReportOutput(struct lemon *lemp)
PRIVATE char *pathsearch(char *argv0, char *name, int modemask)
{
const char *pathlist;
- char *pathbufptr;
+ char *pathbufptr = 0;
char *pathbuf = 0;
char *path,*cp;
char c;
From f573b4fb94e5f40143916b72f1a42c1b1f3a72ee Mon Sep 17 00:00:00 2001
From: drh
Date: Mon, 28 Sep 2020 13:34:05 +0000
Subject: [PATCH 074/169] Avoid the possibility of integer overflow on the
--pagecache option to the CLI. See [forum:10a2892377|forum post 10a2892377]
FossilOrigin-Name: d3d13df31a97648f952beb2e1a783f947a80ec843227985ad9ebd14452d2f654
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/shell.c.in | 9 ++++++---
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/manifest b/manifest
index c85dfe7603..30da967748 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sharmless\scompiler\swarning\sseen\swith\sMSVC.
-D 2020-09-21T20:18:44.298
+C Avoid\sthe\spossibility\sof\sinteger\soverflow\son\sthe\s--pagecache\soption\sto\nthe\sCLI.\sSee\s[forum:10a2892377|forum\spost\s10a2892377]
+D 2020-09-28T13:34:05.229
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -536,7 +536,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 6c3f7d60295f06ce7fa128bb23b1159648f0aa96a78c257af35dfef727ac63f1
-F src/shell.c.in 0fd9eca42731d94a293d7b12a76c6614976f8bdbb2874768ad2e6ddbb86dffd8
+F src/shell.c.in 4e6ea7bf44ace40faf2b4214b7cb336fd15d22d2f7d04b70b5aa10a7716f7be7
F src/sqlite.h.in cb9f0862e8d0f8691de95b18439ab60666f868c83bc65e3a17f0a0b44cc8f8a9
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
@@ -1880,7 +1880,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 782163693f37aeb65209bebbaeb6659a36881b8c4b4bec778b366658488bf966
-R 5af95199526128dc811fede293f15c08
-U mistachkin
-Z 03a5a4cf0703ce5a197f76e2fac51ef2
+P 4591ee03d7a1ef3f0f6ad0629493fdb7a1c0ddb3277a9e87aa244cb0ca770593
+R 096d8fd2cb406180b5d1086b876d6b9e
+U drh
+Z 99fd9cfbb690a189978738ae4f65f4ca
diff --git a/manifest.uuid b/manifest.uuid
index 0af6175d3b..0ccdccbfe1 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-4591ee03d7a1ef3f0f6ad0629493fdb7a1c0ddb3277a9e87aa244cb0ca770593
\ No newline at end of file
+d3d13df31a97648f952beb2e1a783f947a80ec843227985ad9ebd14452d2f654
\ No newline at end of file
diff --git a/src/shell.c.in b/src/shell.c.in
index 1e3a07fe40..0a827335c3 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -10925,11 +10925,14 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
(void)cmdline_option_value(argc, argv, ++i);
#endif
}else if( strcmp(z,"-pagecache")==0 ){
- int n, sz;
- sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
+ sqlite3_int64 n, sz;
+ sz = integerValue(cmdline_option_value(argc,argv,++i));
if( sz>70000 ) sz = 70000;
if( sz<0 ) sz = 0;
- n = (int)integerValue(cmdline_option_value(argc,argv,++i));
+ n = integerValue(cmdline_option_value(argc,argv,++i));
+ if( sz>0 && n>0 && 0xffffffffffffLL/sz0 && sz>0) ? malloc(n*sz) : 0, sz, n);
data.shellFlgs |= SHFLG_Pagecache;
From 75fa266341f5f7ae87c34a153c7db990d63ccfd4 Mon Sep 17 00:00:00 2001
From: drh
Date: Mon, 28 Sep 2020 15:49:43 +0000
Subject: [PATCH 075/169] Small performance improvement and size reduction by
reducing the size of the WhereTerm object.
FossilOrigin-Name: 43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
---
manifest | 18 +++++++++---------
manifest.uuid | 2 +-
src/where.c | 24 ++++++++++++------------
src/whereInt.h | 6 ++++--
src/wherecode.c | 4 ++--
src/whereexpr.c | 26 +++++++++++++-------------
6 files changed, 41 insertions(+), 39 deletions(-)
diff --git a/manifest b/manifest
index 30da967748..96eacb42ae 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\sthe\spossibility\sof\sinteger\soverflow\son\sthe\s--pagecache\soption\sto\nthe\sCLI.\sSee\s[forum:10a2892377|forum\spost\s10a2892377]
-D 2020-09-28T13:34:05.229
+C Small\sperformance\simprovement\sand\ssize\sreduction\sby\sreducing\sthe\ssize\sof\nthe\sWhereTerm\sobject.
+D 2020-09-28T15:49:43.021
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -622,10 +622,10 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 69e770e96fd56cc21608992bf2c6f1f3dc5cf2572d0495c6a643b06c3a679f14
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
-F src/where.c 23f47e845e304a41d0b221bf67bd170014ae08b673076813fcd945dda1a3d4af
-F src/whereInt.h eb8c2847fb464728533777efec1682b3c074224293b2da73513c61a609efbeab
-F src/wherecode.c 9afd600ca9fe831f342121cca48ad8839c8a18ca4e0372518a0a3c8123a8f022
-F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7
+F src/where.c 7ed6512e73e679231ebdeba470055e8d8e871a020b7f3f8dc75e993aaebdcbcd
+F src/whereInt.h db7472b6eb617b5853ae74bbd755383e2275be72ae03ff07cc8ea141bb146dc8
+F src/wherecode.c 895ff782a62370a823c99dc7e1bca09ffd90392c9fafc007b6d3df4811e88b4f
+F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
@@ -1880,7 +1880,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 4591ee03d7a1ef3f0f6ad0629493fdb7a1c0ddb3277a9e87aa244cb0ca770593
-R 096d8fd2cb406180b5d1086b876d6b9e
+P d3d13df31a97648f952beb2e1a783f947a80ec843227985ad9ebd14452d2f654
+R 7b8c3cb46dfe068597bdde1b75906671
U drh
-Z 99fd9cfbb690a189978738ae4f65f4ca
+Z d72bcf93f915317cb95885e250422e3c
diff --git a/manifest.uuid b/manifest.uuid
index 0ccdccbfe1..f071ea53f6 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-d3d13df31a97648f952beb2e1a783f947a80ec843227985ad9ebd14452d2f654
\ No newline at end of file
+43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
\ No newline at end of file
diff --git a/src/where.c b/src/where.c
index ce276bf401..9049a59f28 100644
--- a/src/where.c
+++ b/src/where.c
@@ -257,7 +257,7 @@ static WhereTerm *whereScanNext(WhereScan *pScan){
do{
for(pTerm=pWC->a+k; knTerm; k++, pTerm++){
if( pTerm->leftCursor==iCur
- && pTerm->u.leftColumn==iColumn
+ && pTerm->u.x.leftColumn==iColumn
&& (iColumn!=XN_EXPR
|| sqlite3ExprCompareSkip(pTerm->pExpr->pLeft,
pScan->pIdxExpr,iCur)==0)
@@ -679,8 +679,8 @@ static int termCanDriveIndex(
return 0;
}
if( (pTerm->prereqRight & notReady)!=0 ) return 0;
- if( pTerm->u.leftColumn<0 ) return 0;
- aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity;
+ if( pTerm->u.x.leftColumn<0 ) return 0;
+ aff = pSrc->pTab->aCol[pTerm->u.x.leftColumn].affinity;
if( !sqlite3IndexAffinityOk(pTerm->pExpr, aff) ) return 0;
testcase( pTerm->pExpr->op==TK_IS );
return 1;
@@ -751,7 +751,7 @@ static void constructAutomaticIndex(
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
- int iCol = pTerm->u.leftColumn;
+ int iCol = pTerm->u.x.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
@@ -804,14 +804,14 @@ static void constructAutomaticIndex(
idxCols = 0;
for(pTerm=pWC->a; pTermu.leftColumn;
+ int iCol = pTerm->u.x.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
- pIdx->aiColumn[n] = pTerm->u.leftColumn;
+ pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
pColl = sqlite3ExprCompareCollSeq(pParse, pX);
assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
@@ -932,7 +932,7 @@ static sqlite3_index_info *allocateIndexInfo(
testcase( pTerm->eOperator & WO_ALL );
if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
if( pTerm->wtFlags & TERM_VNULL ) continue;
- assert( pTerm->u.leftColumn>=(-1) );
+ assert( pTerm->u.x.leftColumn>=(-1) );
nTerm++;
}
@@ -992,8 +992,8 @@ static sqlite3_index_info *allocateIndexInfo(
){
continue;
}
- assert( pTerm->u.leftColumn>=(-1) );
- pIdxCons[j].iColumn = pTerm->u.leftColumn;
+ assert( pTerm->u.x.leftColumn>=(-1) );
+ pIdxCons[j].iColumn = pTerm->u.x.leftColumn;
pIdxCons[j].iTermOffset = i;
op = pTerm->eOperator & WO_ALL;
if( op==WO_IN ) op = WO_EQ;
@@ -1756,7 +1756,7 @@ void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){
if( pTerm->wtFlags & TERM_CODED ) zType[3] = 'C';
if( pTerm->eOperator & WO_SINGLE ){
sqlite3_snprintf(sizeof(zLeft),zLeft,"left={%d:%d}",
- pTerm->leftCursor, pTerm->u.leftColumn);
+ pTerm->leftCursor, pTerm->u.x.leftColumn);
}else if( (pTerm->eOperator & WO_OR)!=0 && pTerm->u.pOrInfo!=0 ){
sqlite3_snprintf(sizeof(zLeft),zLeft,"indexable=0x%lld",
pTerm->u.pOrInfo->indexable);
@@ -1772,8 +1772,8 @@ void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){
sqlite3DebugPrintf(" prob=%-3d prereq=%llx,%llx",
pTerm->truthProb, (u64)pTerm->prereqAll, (u64)pTerm->prereqRight);
}
- if( pTerm->iField ){
- sqlite3DebugPrintf(" iField=%d", pTerm->iField);
+ if( pTerm->u.x.iField ){
+ sqlite3DebugPrintf(" iField=%d", pTerm->u.x.iField);
}
if( pTerm->iParent>=0 ){
sqlite3DebugPrintf(" iParent=%d", pTerm->iParent);
diff --git a/src/whereInt.h b/src/whereInt.h
index e8df283d71..0a2b5c5cef 100644
--- a/src/whereInt.h
+++ b/src/whereInt.h
@@ -261,9 +261,11 @@ struct WhereTerm {
u8 eMatchOp; /* Op for vtab MATCH/LIKE/GLOB/REGEXP terms */
int iParent; /* Disable pWC->a[iParent] when this term disabled */
int leftCursor; /* Cursor number of X in "X " */
- int iField; /* Field in (?,?,?) IN (SELECT...) vector */
union {
- int leftColumn; /* Column number of X in "X " */
+ struct {
+ int leftColumn; /* Column number of X in "X " */
+ int iField; /* Field in (?,?,?) IN (SELECT...) vector */
+ } x; /* Opcode other than OP_OR or OP_AND */
WhereOrInfo *pOrInfo; /* Extra information if (eOperator & WO_OR)!=0 */
WhereAndInfo *pAndInfo; /* Extra information if (eOperator& WO_AND)!=0 */
} u;
diff --git a/src/wherecode.c b/src/wherecode.c
index ae3a197570..e3310b314e 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -427,7 +427,7 @@ static Expr *removeUnindexableInClauseTerms(
for(i=iEq; inLTerm; i++){
if( pLoop->aLTerm[i]->pExpr==pX ){
- int iField = pLoop->aLTerm[i]->iField - 1;
+ int iField = pLoop->aLTerm[i]->u.x.iField - 1;
if( pOrigRhs->a[iField].pExpr==0 ) continue; /* Duplicate PK column */
pRhs = sqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr);
pOrigRhs->a[iField].pExpr = 0;
@@ -2414,7 +2414,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
#endif
assert( !ExprHasProperty(pE, EP_FromJoin) );
assert( (pTerm->prereqRight & pLevel->notReady)!=0 );
- pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.leftColumn, notReady,
+ pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.x.leftColumn, notReady,
WO_EQ|WO_IN|WO_IS, 0);
if( pAlt==0 ) continue;
if( pAlt->wtFlags & (TERM_CODED) ) continue;
diff --git a/src/whereexpr.c b/src/whereexpr.c
index 3c91fc3539..aa3f780602 100644
--- a/src/whereexpr.c
+++ b/src/whereexpr.c
@@ -798,7 +798,7 @@ static void exprAnalyzeOrTerm(
assert( pOrTerm->wtFlags & (TERM_COPIED|TERM_VIRTUAL) );
continue;
}
- iColumn = pOrTerm->u.leftColumn;
+ iColumn = pOrTerm->u.x.leftColumn;
iCursor = pOrTerm->leftCursor;
pLeft = pOrTerm->pExpr->pLeft;
break;
@@ -820,7 +820,7 @@ static void exprAnalyzeOrTerm(
assert( pOrTerm->eOperator & WO_EQ );
if( pOrTerm->leftCursor!=iCursor ){
pOrTerm->wtFlags &= ~TERM_OR_OK;
- }else if( pOrTerm->u.leftColumn!=iColumn || (iColumn==XN_EXPR
+ }else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR
&& sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1)
)){
okToChngToIN = 0;
@@ -855,7 +855,7 @@ static void exprAnalyzeOrTerm(
if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue;
assert( pOrTerm->eOperator & WO_EQ );
assert( pOrTerm->leftCursor==iCursor );
- assert( pOrTerm->u.leftColumn==iColumn );
+ assert( pOrTerm->u.x.leftColumn==iColumn );
pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0);
pList = sqlite3ExprListAppend(pWInfo->pParse, pList, pDup);
pLeft = pOrTerm->pExpr->pLeft;
@@ -1091,15 +1091,15 @@ static void exprAnalyze(
Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight);
u16 opMask = (pTerm->prereqRight & prereqLeft)==0 ? WO_ALL : WO_EQUIV;
- if( pTerm->iField>0 ){
+ if( pTerm->u.x.iField>0 ){
assert( op==TK_IN );
assert( pLeft->op==TK_VECTOR );
- pLeft = pLeft->x.pList->a[pTerm->iField-1].pExpr;
+ pLeft = pLeft->x.pList->a[pTerm->u.x.iField-1].pExpr;
}
if( exprMightBeIndexed(pSrc, prereqLeft, aiCurCol, pLeft, op) ){
pTerm->leftCursor = aiCurCol[0];
- pTerm->u.leftColumn = aiCurCol[1];
+ pTerm->u.x.leftColumn = aiCurCol[1];
pTerm->eOperator = operatorMask(op) & opMask;
}
if( op==TK_IS ) pTerm->wtFlags |= TERM_IS;
@@ -1109,7 +1109,7 @@ static void exprAnalyze(
WhereTerm *pNew;
Expr *pDup;
u16 eExtraOp = 0; /* Extra bits for pNew->eOperator */
- assert( pTerm->iField==0 );
+ assert( pTerm->u.x.iField==0 );
if( pTerm->leftCursor>=0 ){
int idxNew;
pDup = sqlite3ExprDup(db, pExpr, 0);
@@ -1135,7 +1135,7 @@ static void exprAnalyze(
}
pNew->wtFlags |= exprCommute(pParse, pDup);
pNew->leftCursor = aiCurCol[0];
- pNew->u.leftColumn = aiCurCol[1];
+ pNew->u.x.leftColumn = aiCurCol[1];
testcase( (prereqLeft | extraRight) != prereqLeft );
pNew->prereqRight = prereqLeft | extraRight;
pNew->prereqAll = prereqAll;
@@ -1309,7 +1309,7 @@ static void exprAnalyze(
pNewTerm = &pWC->a[idxNew];
pNewTerm->prereqRight = prereqExpr;
pNewTerm->leftCursor = pLeft->iTable;
- pNewTerm->u.leftColumn = pLeft->iColumn;
+ pNewTerm->u.x.leftColumn = pLeft->iColumn;
pNewTerm->eOperator = WO_AUX;
pNewTerm->eMatchOp = eOp2;
markTermAsChild(pWC, idxNew, idxTerm);
@@ -1356,13 +1356,13 @@ static void exprAnalyze(
/* If there is a vector IN term - e.g. "(a, b) IN (SELECT ...)" - create
** a virtual term for each vector component. The expression object
** used by each such virtual term is pExpr (the full vector IN(...)
- ** expression). The WhereTerm.iField variable identifies the index within
+ ** expression). The WhereTerm.u.x.iField variable identifies the index within
** the vector on the LHS that the virtual term represents.
**
** This only works if the RHS is a simple SELECT (not a compound) that does
** not use window functions.
*/
- if( pWC->op==TK_AND && pExpr->op==TK_IN && pTerm->iField==0
+ if( pWC->op==TK_AND && pExpr->op==TK_IN && pTerm->u.x.iField==0
&& pExpr->pLeft->op==TK_VECTOR
&& pExpr->x.pSelect->pPrior==0
#ifndef SQLITE_OMIT_WINDOWFUNC
@@ -1373,7 +1373,7 @@ static void exprAnalyze(
for(i=0; ipLeft); i++){
int idxNew;
idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL);
- pWC->a[idxNew].iField = i+1;
+ pWC->a[idxNew].u.x.iField = i+1;
exprAnalyze(pSrc, pWC, idxNew);
markTermAsChild(pWC, idxNew, idxTerm);
}
@@ -1408,7 +1408,7 @@ static void exprAnalyze(
pNewTerm = &pWC->a[idxNew];
pNewTerm->prereqRight = 0;
pNewTerm->leftCursor = pLeft->iTable;
- pNewTerm->u.leftColumn = pLeft->iColumn;
+ pNewTerm->u.x.leftColumn = pLeft->iColumn;
pNewTerm->eOperator = WO_GT;
markTermAsChild(pWC, idxNew, idxTerm);
pTerm = &pWC->a[idxTerm];
From 68cf0ace3d160c8b3c12ee692c337f0d47e079d7 Mon Sep 17 00:00:00 2001
From: drh
Date: Mon, 28 Sep 2020 19:51:54 +0000
Subject: [PATCH 076/169] Revisiting the IN-scan optimization to try to fix it
for the corner case where the statistics deceive the query planner into using
a scan when an indexed lookup would be better. This check-in changes the
code generation to do the IN-scan using a new OP_SeekScan opcode. That new
opcode is designed to abandon the scan and fall back to a seek if it doesn't
find a match quickly enough. For this work-in-progress check-in, OP_SeekScan
is still a no-op and OP_SeekGE still ends up doing all the work.
FossilOrigin-Name: d720b6981eeb0ffdb14494ca63eca298ee724ae4ad4863c7c7cbfdad7fa52519
---
manifest | 21 +++++++++++---------
manifest.uuid | 2 +-
src/vdbe.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
src/where.c | 3 ++-
src/whereInt.h | 1 +
src/wherecode.c | 5 +++++
6 files changed, 74 insertions(+), 11 deletions(-)
diff --git a/manifest b/manifest
index 96eacb42ae..4e0a60c882 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Small\sperformance\simprovement\sand\ssize\sreduction\sby\sreducing\sthe\ssize\sof\nthe\sWhereTerm\sobject.
-D 2020-09-28T15:49:43.021
+C Revisiting\sthe\sIN-scan\soptimization\sto\stry\sto\sfix\sit\sfor\sthe\scorner\scase\nwhere\sthe\sstatistics\sdeceive\sthe\squery\splanner\sinto\susing\sa\sscan\swhen\nan\sindexed\slookup\swould\sbe\sbetter.\s\sThis\scheck-in\schanges\sthe\scode\ngeneration\sto\sdo\sthe\sIN-scan\susing\sa\snew\sOP_SeekScan\sopcode.\s\sThat\snew\nopcode\sis\sdesigned\sto\sabandon\sthe\sscan\sand\sfall\sback\sto\sa\sseek\sif\nit\sdoesn't\sfind\sa\smatch\squickly\senough.\s\sFor\sthis\swork-in-progress\scheck-in,\s\nOP_SeekScan\sis\sstill\sa\sno-op\sand\sOP_SeekGE\sstill\sends\sup\sdoing\sall\sthe\swork.
+D 2020-09-28T19:51:54.673
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c 6430a540012b8b4c81076565804fcb979040e1b1a43ce76d2381863884155d84
+F src/vdbe.c 17584029ae2c2acc955f3dc19858fad1a3d509f31d42ddd2ff7be3552d4c77d3
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -622,9 +622,9 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 69e770e96fd56cc21608992bf2c6f1f3dc5cf2572d0495c6a643b06c3a679f14
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
-F src/where.c 7ed6512e73e679231ebdeba470055e8d8e871a020b7f3f8dc75e993aaebdcbcd
-F src/whereInt.h db7472b6eb617b5853ae74bbd755383e2275be72ae03ff07cc8ea141bb146dc8
-F src/wherecode.c 895ff782a62370a823c99dc7e1bca09ffd90392c9fafc007b6d3df4811e88b4f
+F src/where.c c628a6850b023cfacfdbf6060481eae5e538ccb3c3464a700b501e08d4cce74b
+F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
+F src/wherecode.c 4096498d05f0c1bfff435ef48679e774a345bb2c700215da1383902e14877d5c
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1880,7 +1880,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d3d13df31a97648f952beb2e1a783f947a80ec843227985ad9ebd14452d2f654
-R 7b8c3cb46dfe068597bdde1b75906671
+P 43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
+R 91153af0a9416b3fbb7b5420545d1fbb
+T *branch * in-scan-vs-index
+T *sym-in-scan-vs-index *
+T -sym-trunk *
U drh
-Z d72bcf93f915317cb95885e250422e3c
+Z 22384fb99540c2e7915964a3edd63b6d
diff --git a/manifest.uuid b/manifest.uuid
index f071ea53f6..0ba7bb60dc 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
\ No newline at end of file
+d720b6981eeb0ffdb14494ca63eca298ee724ae4ad4863c7c7cbfdad7fa52519
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index a579b4ea11..d14838e4f1 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4383,6 +4383,59 @@ seek_not_found:
break;
}
+
+/* Opcode: SeekScan
+** Synopsis: Scan-ahead up to P1 rows
+**
+** This opcode is a prefix. It must be followed immediately by
+** OP_SeekGE and then OP_IdxGT. This opcode should occur in no other
+** context. That constraint is verified using assert() statements in
+** the code.
+**
+** This opcode helps to optimize IN operators on a multi-column index
+** where the IN operator is on the later terms of the index.
+**
+** The P3 and P4 operations of the OP_SeekGE opcode that follows this
+** opcode identify an unpacked key which is the desired entry that
+** we want to advance the cursor to. Call this the "target".
+**
+** If the OP_SeekGE opcode that immediately follows this opcode has
+** never run before, then this opcode is a no-op and control passes
+** through into the OP_SeekGE.
+**
+** If the subsequent OP_SeekGE opcode has run before, then that prior
+** might OP_SeekGE might have left the cursor pointing any entry that
+** is close to the target. This routine checks, and if possible
+** bypasses the OP_SeekGE.
+**
+** If the cursor is past the target, jump immediately to the
+** P2 of the subsequent OP_SeekGE.
+**
+** If the cursor is less than the target, then step forward up to P1
+** times trying to find a match. If during these steps, the
+** cursor moves past the target, then jump immediately to
+** the P2 of the subsequent OP_SeekGE. If a match is found, jump
+** to the first instruction past the OP_IdxGT that follows the
+** OP_SeekGE. (In other words, skip over the next two opcodes).
+** If P1 steps are performed and the cursor is still less than the
+** target, then fall through into OP_SeekGE opcode.
+**
+** This opcode is an optimization. This opcode can be a no-op and
+** the correct answer should still be obtained. The purpose of this
+** opcode is to bypass unnecessary OP_SeekGE operations.
+*/
+case OP_SeekScan: {
+ assert( pOp[1].opcode==OP_SeekGE );
+ assert( pOp[2].opcode==OP_IdxGT );
+ assert( pOp[1].p1==pOp[2].p1 );
+ assert( pOp[1].p2==pOp[2].p2 );
+ assert( pOp[1].p3==pOp[2].p3 );
+ assert( pOp[1].p4.i==pOp[2].p4.i );
+ assert( pOp->p1>0 );
+ break; /* No-op for now. FIX ME. */
+}
+
+
/* Opcode: SeekHit P1 P2 P3 * *
** Synopsis: set P2<=seekHit<=P3
**
diff --git a/src/where.c b/src/where.c
index 9049a59f28..0ab5adee8f 100644
--- a/src/where.c
+++ b/src/where.c
@@ -2564,7 +2564,7 @@ static int whereLoopAddBtreeIndex(
WHERETRACE(0x40,
("Scan preferred over IN operator on column %d of \"%s\" (%d<%d)\n",
saved_nEq, pProbe->zName, M+logK+10, nIn+rLogSize));
- continue;
+ pNew->wsFlags |= WHERE_IN_SEEKSCAN;
}else{
WHERETRACE(0x40,
("IN operator preferred on column %d of \"%s\" (%d>=%d)\n",
@@ -5197,6 +5197,7 @@ WhereInfo *sqlite3WhereBegin(
if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=0
&& (pLoop->wsFlags & (WHERE_COLUMN_RANGE|WHERE_SKIPSCAN))==0
&& (pLoop->wsFlags & WHERE_BIGNULL_SORT)==0
+ && (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0
&& (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0
&& pWInfo->eDistinct!=WHERE_DISTINCT_ORDERED
){
diff --git a/src/whereInt.h b/src/whereInt.h
index 0a2b5c5cef..6c969af9c2 100644
--- a/src/whereInt.h
+++ b/src/whereInt.h
@@ -619,5 +619,6 @@ void sqlite3WhereTabFuncArgs(Parse*, struct SrcList_item*, WhereClause*);
#define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */
#define WHERE_IN_EARLYOUT 0x00040000 /* Perhaps quit IN loops early */
#define WHERE_BIGNULL_SORT 0x00080000 /* Column nEq of index is BIGNULL */
+#define WHERE_IN_SEEKSCAN 0x00100000 /* Seek-scan optimization for IN */
#endif /* !defined(SQLITE_WHEREINT_H) */
diff --git a/src/wherecode.c b/src/wherecode.c
index e3310b314e..8227d0d7d0 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1804,6 +1804,11 @@ Bitmask sqlite3WhereCodeOneLoopStart(
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
assert( op!=0 );
+ if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 ){
+ assert( op==OP_SeekGE );
+ assert( regBignull==0 );
+ sqlite3VdbeAddOp1(v, OP_SeekScan, 10);
+ }
sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
VdbeCoverage(v);
VdbeCoverageIf(v, op==OP_Rewind); testcase( op==OP_Rewind );
From f761d937c233ab7e1ac1a187a80c45846a8d1c52 Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 29 Sep 2020 01:48:46 +0000
Subject: [PATCH 077/169] The OP_SeekScan opcode works, but using it requires
disabling the IN-earlyout optimization because the OP_IfNoHope opcode might
move the cursor.
FossilOrigin-Name: f3c36b840c9a29c0add28039db216f4207a308e5057fc76e3f0004024a8267ac
---
manifest | 19 +++++++--------
manifest.uuid | 2 +-
src/vdbe.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++-
src/where.c | 10 ++++----
src/wherecode.c | 4 ++--
5 files changed, 76 insertions(+), 20 deletions(-)
diff --git a/manifest b/manifest
index 4e0a60c882..52cf306121 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Revisiting\sthe\sIN-scan\soptimization\sto\stry\sto\sfix\sit\sfor\sthe\scorner\scase\nwhere\sthe\sstatistics\sdeceive\sthe\squery\splanner\sinto\susing\sa\sscan\swhen\nan\sindexed\slookup\swould\sbe\sbetter.\s\sThis\scheck-in\schanges\sthe\scode\ngeneration\sto\sdo\sthe\sIN-scan\susing\sa\snew\sOP_SeekScan\sopcode.\s\sThat\snew\nopcode\sis\sdesigned\sto\sabandon\sthe\sscan\sand\sfall\sback\sto\sa\sseek\sif\nit\sdoesn't\sfind\sa\smatch\squickly\senough.\s\sFor\sthis\swork-in-progress\scheck-in,\s\nOP_SeekScan\sis\sstill\sa\sno-op\sand\sOP_SeekGE\sstill\sends\sup\sdoing\sall\sthe\swork.
-D 2020-09-28T19:51:54.673
+C The\sOP_SeekScan\sopcode\sworks,\sbut\susing\sit\srequires\sdisabling\sthe\nIN-earlyout\soptimization\sbecause\sthe\sOP_IfNoHope\sopcode\smight\smove\sthe\ncursor.
+D 2020-09-29T01:48:46.942
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c 17584029ae2c2acc955f3dc19858fad1a3d509f31d42ddd2ff7be3552d4c77d3
+F src/vdbe.c f13b70fa1deea20698e19c86c4aae3cf93495c74b4c57e7139f628cf4f711ddf
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -622,9 +622,9 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 69e770e96fd56cc21608992bf2c6f1f3dc5cf2572d0495c6a643b06c3a679f14
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
-F src/where.c c628a6850b023cfacfdbf6060481eae5e538ccb3c3464a700b501e08d4cce74b
+F src/where.c da9c0d503f81cc8444eb3525b75eec2bb3d198f4d5939b207977f2fc20d85b54
F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
-F src/wherecode.c 4096498d05f0c1bfff435ef48679e774a345bb2c700215da1383902e14877d5c
+F src/wherecode.c 9c2301ecfd8c347969207c1042181ac39573964167ada5bc0025b9a8447d5f8f
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1880,10 +1880,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 43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
-R 91153af0a9416b3fbb7b5420545d1fbb
-T *branch * in-scan-vs-index
-T *sym-in-scan-vs-index *
-T -sym-trunk *
+P d720b6981eeb0ffdb14494ca63eca298ee724ae4ad4863c7c7cbfdad7fa52519
+R 93eab6914a9c3b5b8c8ceb0a0d7c7688
U drh
-Z 22384fb99540c2e7915964a3edd63b6d
+Z 1fb2faea0368362fc6f0f58448eca8a2
diff --git a/manifest.uuid b/manifest.uuid
index 0ba7bb60dc..af2ea4ee4c 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-d720b6981eeb0ffdb14494ca63eca298ee724ae4ad4863c7c7cbfdad7fa52519
\ No newline at end of file
+f3c36b840c9a29c0add28039db216f4207a308e5057fc76e3f0004024a8267ac
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index d14838e4f1..ff1cf87cb1 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4425,6 +4425,11 @@ seek_not_found:
** opcode is to bypass unnecessary OP_SeekGE operations.
*/
case OP_SeekScan: {
+ VdbeCursor *pC;
+ int res;
+ int n;
+ UnpackedRecord r;
+
assert( pOp[1].opcode==OP_SeekGE );
assert( pOp[2].opcode==OP_IdxGT );
assert( pOp[1].p1==pOp[2].p1 );
@@ -4432,7 +4437,61 @@ case OP_SeekScan: {
assert( pOp[1].p3==pOp[2].p3 );
assert( pOp[1].p4.i==pOp[2].p4.i );
assert( pOp->p1>0 );
- break; /* No-op for now. FIX ME. */
+ pC = p->apCsr[pOp[1].p1];
+ assert( pC!=0 );
+ assert( pC->eCurType==CURTYPE_BTREE );
+ assert( !pC->isTable );
+ if( pC->nullRow ){
+#ifdef SQLITE_DEBUG
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... no prior seeks - fall through\n");
+ }
+#endif
+ break;
+ }
+ n = pOp->p1;
+ assert( n>=1 );
+ r.pKeyInfo = pC->pKeyInfo;
+ r.nField = (u16)pOp[1].p4.i;
+ r.default_rc = 0;
+ r.aMem = &aMem[pOp[1].p3];
+#ifdef SQLITE_DEBUG
+ {
+ int i;
+ for(i=0; i0 ){
+#ifdef SQLITE_DEBUG
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... %d steps and then skip\n", pOp->p1 - n);
+ }
+#endif
+ pOp++;
+ goto jump_to_p2;
+ }
+ if( res==0 ){
+#ifdef SQLITE_DEBUG
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... %d steps and then success\n", pOp->p1 - n);
+ }
+#endif
+ pOp += 2;
+ break;
+ }
+ if( n<=0 ) break;
+ n--;
+ rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
+ if( rc ) goto abort_due_to_error;
+ }
+ break;
}
diff --git a/src/where.c b/src/where.c
index 0ab5adee8f..8a33e86194 100644
--- a/src/where.c
+++ b/src/where.c
@@ -5360,7 +5360,9 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
sqlite3VdbeJumpHere(v, pIn->addrInTop+1);
if( pIn->eEndLoopOp!=OP_Noop ){
if( pIn->nPrefix ){
- assert( pLoop->wsFlags & WHERE_IN_EARLYOUT );
+ int bEarlyOut =
+ (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
+ && (pLoop->wsFlags & WHERE_IN_EARLYOUT)!=0;
if( pLevel->iLeftJoin ){
/* For LEFT JOIN queries, cursor pIn->iCur may not have been
** opened yet. This occurs for WHERE clauses such as
@@ -5371,12 +5373,10 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
** jump over the OP_Next or OP_Prev instruction about to
** be coded. */
sqlite3VdbeAddOp2(v, OP_IfNotOpen, pIn->iCur,
- sqlite3VdbeCurrentAddr(v) + 2 +
- ((pLoop->wsFlags & WHERE_VIRTUALTABLE)==0)
- );
+ sqlite3VdbeCurrentAddr(v) + 2 + bEarlyOut);
VdbeCoverage(v);
}
- if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
+ if( bEarlyOut ){
sqlite3VdbeAddOp4Int(v, OP_IfNoHope, pLevel->iIdxCur,
sqlite3VdbeCurrentAddr(v)+2,
pIn->iBase, pIn->nPrefix);
diff --git a/src/wherecode.c b/src/wherecode.c
index 8227d0d7d0..adf03e6c38 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -570,7 +570,7 @@ static int codeEqualityTerm(
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
- if( iEq>0 ){
+ if( iEq>0 && (pLoop->wsFlags && WHERE_IN_SEEKSCAN)==0 ){
pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}
@@ -1911,7 +1911,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
}
- if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
+ if( (pLoop->wsFlags & WHERE_IN_EARLYOUT)!=0 ){
sqlite3VdbeAddOp3(v, OP_SeekHit, iIdxCur, nEq, nEq);
}
From 46f0f4e56d8d818f417fa8f14ab4837133003b5d Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 29 Sep 2020 15:32:54 +0000
Subject: [PATCH 078/169] Typo fix to repair the early-out optimization. Also
avoid unnecessary OP_SeekHit opcodes.
FossilOrigin-Name: 8fd7d8dfcd515aa6b65d6eb27b033d3b3a31db467b9100cc13c62bc60113019e
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/wherecode.c | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index 52cf306121..7c1a305702 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C The\sOP_SeekScan\sopcode\sworks,\sbut\susing\sit\srequires\sdisabling\sthe\nIN-earlyout\soptimization\sbecause\sthe\sOP_IfNoHope\sopcode\smight\smove\sthe\ncursor.
-D 2020-09-29T01:48:46.942
+C Typo\sfix\sto\srepair\sthe\searly-out\soptimization.\s\sAlso\savoid\sunnecessary\nOP_SeekHit\sopcodes.
+D 2020-09-29T15:32:54.786
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c da9c0d503f81cc8444eb3525b75eec2bb3d198f4d5939b207977f2fc20d85b54
F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
-F src/wherecode.c 9c2301ecfd8c347969207c1042181ac39573964167ada5bc0025b9a8447d5f8f
+F src/wherecode.c 89d14a834b48b9ead4415024a79a4895a3d4363b37e377a487479e9ed59118db
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1880,7 +1880,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 d720b6981eeb0ffdb14494ca63eca298ee724ae4ad4863c7c7cbfdad7fa52519
-R 93eab6914a9c3b5b8c8ceb0a0d7c7688
+P f3c36b840c9a29c0add28039db216f4207a308e5057fc76e3f0004024a8267ac
+R b45e4e5d13e7104361979e961b4ebdf2
U drh
-Z 1fb2faea0368362fc6f0f58448eca8a2
+Z 6ed8ad20e25361c120133ce9ede87a2a
diff --git a/manifest.uuid b/manifest.uuid
index af2ea4ee4c..9fab159b67 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-f3c36b840c9a29c0add28039db216f4207a308e5057fc76e3f0004024a8267ac
\ No newline at end of file
+8fd7d8dfcd515aa6b65d6eb27b033d3b3a31db467b9100cc13c62bc60113019e
\ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index adf03e6c38..4e10c79d8d 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -570,7 +570,7 @@ static int codeEqualityTerm(
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
- if( iEq>0 && (pLoop->wsFlags && WHERE_IN_SEEKSCAN)==0 ){
+ if( iEq>0 && (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0 ){
pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}
@@ -608,7 +608,7 @@ static int codeEqualityTerm(
pIn++;
}
}
- if( iEq>0 ){
+ if( iEq>0 && (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0 ){
sqlite3VdbeAddOp3(v, OP_SeekHit, pLevel->iIdxCur, 0, iEq);
}
}else{
From c40076a8cf32c0b54edc09a407d7d7c1c3ee9ae9 Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 29 Sep 2020 16:05:09 +0000
Subject: [PATCH 079/169] Improved performance by manually in-lining the
sqlite3VdbeIdxKeyCompare() routine for the OP_IdxGT opcode and its kin.
FossilOrigin-Name: 2206a2c848a122ee220c89427f9be0460cba0706f58852139d7b37184ce29a29
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/vdbe.c | 29 ++++++++++++++++++++++++++---
3 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/manifest b/manifest
index 7c1a305702..c6fe2f1e83 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Typo\sfix\sto\srepair\sthe\searly-out\soptimization.\s\sAlso\savoid\sunnecessary\nOP_SeekHit\sopcodes.
-D 2020-09-29T15:32:54.786
+C Improved\sperformance\sby\smanually\sin-lining\sthe\ssqlite3VdbeIdxKeyCompare()\nroutine\sfor\sthe\sOP_IdxGT\sopcode\sand\sits\skin.
+D 2020-09-29T16:05:09.270
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c f13b70fa1deea20698e19c86c4aae3cf93495c74b4c57e7139f628cf4f711ddf
+F src/vdbe.c 72fa5727e874b51f24b72ef12dfec8738e724b4c70c308f1e9fc3b955375f214
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -1880,7 +1880,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 f3c36b840c9a29c0add28039db216f4207a308e5057fc76e3f0004024a8267ac
-R b45e4e5d13e7104361979e961b4ebdf2
+P 8fd7d8dfcd515aa6b65d6eb27b033d3b3a31db467b9100cc13c62bc60113019e
+R 4899ba483a1f0c89bb1918b365591512
U drh
-Z 6ed8ad20e25361c120133ce9ede87a2a
+Z ee02d60aca1d7fbfb9e679e7d8012083
diff --git a/manifest.uuid b/manifest.uuid
index 9fab159b67..c1f427098e 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-8fd7d8dfcd515aa6b65d6eb27b033d3b3a31db467b9100cc13c62bc60113019e
\ No newline at end of file
+2206a2c848a122ee220c89427f9be0460cba0706f58852139d7b37184ce29a29
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index ff1cf87cb1..2f38a0b3a5 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -6026,8 +6026,31 @@ case OP_IdxGE: { /* jump */
}
}
#endif
- res = 0; /* Not needed. Only used to silence a warning. */
- rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);
+
+ /* Inlined version of sqlite3VdbeIdxKeyCompare() */
+ {
+ i64 nCellKey = 0;
+ BtCursor *pCur;
+ Mem m;
+
+ assert( pC->eCurType==CURTYPE_BTREE );
+ pCur = pC->uc.pCursor;
+ assert( sqlite3BtreeCursorIsValid(pCur) );
+ nCellKey = sqlite3BtreePayloadSize(pCur);
+ /* nCellKey will always be between 0 and 0xffffffff because of the way
+ ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */
+ if( nCellKey<=0 || nCellKey>0x7fffffff ){
+ rc = SQLITE_CORRUPT_BKPT;
+ goto abort_due_to_error;
+ }
+ sqlite3VdbeMemInit(&m, db, 0);
+ rc = sqlite3VdbeMemFromBtreeZeroOffset(pCur, (u32)nCellKey, &m);
+ if( rc ) goto abort_due_to_error;
+ res = sqlite3VdbeRecordCompareWithSkip(m.n, m.z, &r, 0);
+ sqlite3VdbeMemRelease(&m);
+ }
+ /* End of inlined sqlite3VdbeIdxKeyCompare() */
+
assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) );
if( (pOp->opcode&1)==(OP_IdxLT&1) ){
assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxLT );
@@ -6037,7 +6060,7 @@ case OP_IdxGE: { /* jump */
res++;
}
VdbeBranchTaken(res>0,2);
- if( rc ) goto abort_due_to_error;
+ assert( rc==SQLITE_OK );
if( res>0 ) goto jump_to_p2;
break;
}
From dfbaae7572b76e48eab50819aafb13b0cef8a98b Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 29 Sep 2020 17:29:11 +0000
Subject: [PATCH 080/169] Improved comments on the new OP_SeekScan opcode.
FossilOrigin-Name: 6110fdd5bb7b4ae5c065404c802ae726362ef084966b73cffe58c4bfb98689d2
---
manifest | 12 +++++-----
manifest.uuid | 2 +-
src/vdbe.c | 62 +++++++++++++++++++++++++++++----------------------
3 files changed, 42 insertions(+), 34 deletions(-)
diff --git a/manifest b/manifest
index c6fe2f1e83..9da918b734 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improved\sperformance\sby\smanually\sin-lining\sthe\ssqlite3VdbeIdxKeyCompare()\nroutine\sfor\sthe\sOP_IdxGT\sopcode\sand\sits\skin.
-D 2020-09-29T16:05:09.270
+C Improved\scomments\son\sthe\snew\sOP_SeekScan\sopcode.
+D 2020-09-29T17:29:11.276
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c 72fa5727e874b51f24b72ef12dfec8738e724b4c70c308f1e9fc3b955375f214
+F src/vdbe.c f1dfd1fc1911876ac8ade2d1e9c3055242ec9de857fc7f72c9c75f712e6acde3
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -1880,7 +1880,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 8fd7d8dfcd515aa6b65d6eb27b033d3b3a31db467b9100cc13c62bc60113019e
-R 4899ba483a1f0c89bb1918b365591512
+P 2206a2c848a122ee220c89427f9be0460cba0706f58852139d7b37184ce29a29
+R 1f20d571e0b39b4a04d29411b17457a4
U drh
-Z ee02d60aca1d7fbfb9e679e7d8012083
+Z fc780e21a0f22dec17fca15dd256ba17
diff --git a/manifest.uuid b/manifest.uuid
index c1f427098e..f5cbb057c3 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-2206a2c848a122ee220c89427f9be0460cba0706f58852139d7b37184ce29a29
\ No newline at end of file
+6110fdd5bb7b4ae5c065404c802ae726362ef084966b73cffe58c4bfb98689d2
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index 2f38a0b3a5..dacda15074 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4384,45 +4384,53 @@ seek_not_found:
}
-/* Opcode: SeekScan
+/* Opcode: SeekScan P1 * * * *
** Synopsis: Scan-ahead up to P1 rows
**
-** This opcode is a prefix. It must be followed immediately by
-** OP_SeekGE and then OP_IdxGT. This opcode should occur in no other
-** context. That constraint is verified using assert() statements in
-** the code.
+** This opcode is a prefix opcode to OP_SeekGE. In other words, this
+** opcode must be immediately followed by OP_SeekGE. Furthermore, the
+** OP_SeekGE must be followed by OP_IdxGT. These constraints are
+** checked by assert() statements.
+**
+** This opcode uses the P1 through P4 operands of the subsequent
+** OP_SeekGE. In the text that follows, the operands of the subsequent
+** OP_SeekGE opcode are denoted as SeekOP.P1 through SeekOP.P4. Only
+** the P1 operand of this opcode is used, and it is denoted as This.P1.
**
** This opcode helps to optimize IN operators on a multi-column index
-** where the IN operator is on the later terms of the index.
+** where the IN operator is on the later terms of the index by avoiding
+** unnecessary seeks on the btree, substituting steps to the next row
+** of the b-tree instead. A correct answer is obtained if this opcode
+** is omitted or is a no-op.
**
-** The P3 and P4 operations of the OP_SeekGE opcode that follows this
-** opcode identify an unpacked key which is the desired entry that
-** we want to advance the cursor to. Call this the "target".
+** The SeekGE.P3 and SeekGE.P4 operands identify an unpacked key which
+** is the desired entry that we want the cursor SeekGE.P1 to be pointing
+** to. Call this SeekGE.P4/P5 row the "target".
**
** If the OP_SeekGE opcode that immediately follows this opcode has
-** never run before, then this opcode is a no-op and control passes
+** never run before, which is to say if the SeekGE.P1 cursor is not pointing
+** to a valid raow, then this opcode is a no-op and control passes
** through into the OP_SeekGE.
**
-** If the subsequent OP_SeekGE opcode has run before, then that prior
-** might OP_SeekGE might have left the cursor pointing any entry that
-** is close to the target. This routine checks, and if possible
-** bypasses the OP_SeekGE.
+** If the SeekGE.P1 cursor is pointing to a valid row, then that row
+** might be the target row, or it might be near and slightly before the
+** target row. This opcode attempts to position the cursor on the target
+** row by, perhaps stepping by invoking sqlite3BtreeStep() on the cursor
+** between 0 and This.P1 times.
**
-** If the cursor is past the target, jump immediately to the
-** P2 of the subsequent OP_SeekGE.
+** There are three possible outcomes from this opcode:
**
-** If the cursor is less than the target, then step forward up to P1
-** times trying to find a match. If during these steps, the
-** cursor moves past the target, then jump immediately to
-** the P2 of the subsequent OP_SeekGE. If a match is found, jump
-** to the first instruction past the OP_IdxGT that follows the
-** OP_SeekGE. (In other words, skip over the next two opcodes).
-** If P1 steps are performed and the cursor is still less than the
-** target, then fall through into OP_SeekGE opcode.
+** - If after This.P1 steps, the cursor is still point to a place that
+** is earlier in the btree than the target row,
+** then fall through into the subsquence OP_SeekGE opcode.
**
-** This opcode is an optimization. This opcode can be a no-op and
-** the correct answer should still be obtained. The purpose of this
-** opcode is to bypass unnecessary OP_SeekGE operations.
+**
- If the cursor is successfully moved to the target row by 0 or more
+** sqlite3BtreeNext() calls, then jump to the first instruction after the
+** OP_IdxGT opcode - or in other words, skip the next two opcodes.
+**
+**
- If the cursor ends up past the target row (indicating the the target
+** row does not exist in the btree) then jump to SeekOP.P2.
+**
*/
case OP_SeekScan: {
VdbeCursor *pC;
From 0b2949c36ec15d1f340e59345e236129397b4595 Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 29 Sep 2020 20:22:19 +0000
Subject: [PATCH 081/169] Coverage testing of the OP_SeekScan opcode. Fix a
problem that comes up when OP_SeekScan reaches the end of the table.
FossilOrigin-Name: 9e57e758a6a33f54d28a546b4eebfb5cfacef30dc4e0207e43bb9d2c06fc3439
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/vdbe.c | 35 +++++++++++++++++++++++++++--------
src/wherecode.c | 2 +-
4 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/manifest b/manifest
index 9da918b734..d06d277e87 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improved\scomments\son\sthe\snew\sOP_SeekScan\sopcode.
-D 2020-09-29T17:29:11.276
+C Coverage\stesting\sof\sthe\sOP_SeekScan\sopcode.\s\sFix\sa\sproblem\sthat\scomes\sup\swhen\nOP_SeekScan\sreaches\sthe\send\sof\sthe\stable.
+D 2020-09-29T20:22:20.000
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c f1dfd1fc1911876ac8ade2d1e9c3055242ec9de857fc7f72c9c75f712e6acde3
+F src/vdbe.c a5f9dbd62905ce5f7fde94c4b6e9d24eeb0e1844a4f352d7ce7b447bad62afcb
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c da9c0d503f81cc8444eb3525b75eec2bb3d198f4d5939b207977f2fc20d85b54
F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
-F src/wherecode.c 89d14a834b48b9ead4415024a79a4895a3d4363b37e377a487479e9ed59118db
+F src/wherecode.c 8d5e5973bcb5348877ac07ec85fb98cc3bb3b3377b79845cb39b3e812194cc47
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1880,7 +1880,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 2206a2c848a122ee220c89427f9be0460cba0706f58852139d7b37184ce29a29
-R 1f20d571e0b39b4a04d29411b17457a4
+P 6110fdd5bb7b4ae5c065404c802ae726362ef084966b73cffe58c4bfb98689d2
+R 5208a223b9abbea3e3bc1a7c83370262
U drh
-Z fc780e21a0f22dec17fca15dd256ba17
+Z 4e19dcf82e793fd815f6f64707a372c6
diff --git a/manifest.uuid b/manifest.uuid
index f5cbb057c3..bb134a3818 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-6110fdd5bb7b4ae5c065404c802ae726362ef084966b73cffe58c4bfb98689d2
\ No newline at end of file
+9e57e758a6a33f54d28a546b4eebfb5cfacef30dc4e0207e43bb9d2c06fc3439
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index dacda15074..3b52662468 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4477,28 +4477,47 @@ case OP_SeekScan: {
rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);
if( rc ) goto abort_due_to_error;
if( res>0 ){
+ seekscan_search_fail:
#ifdef SQLITE_DEBUG
- if( db->flags&SQLITE_VdbeTrace ){
- printf("... %d steps and then skip\n", pOp->p1 - n);
- }
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... %d steps and then skip\n", pOp->p1 - n);
+ }
#endif
pOp++;
+ VdbeBranchTaken(1,3);
goto jump_to_p2;
}
if( res==0 ){
#ifdef SQLITE_DEBUG
- if( db->flags&SQLITE_VdbeTrace ){
- printf("... %d steps and then success\n", pOp->p1 - n);
- }
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... %d steps and then success\n", pOp->p1 - n);
+ }
#endif
pOp += 2;
+ VdbeBranchTaken(2,3);
+ break;
+ }
+ if( n<=0 ){
+#ifdef SQLITE_DEBUG
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... fall through after %d steps\n", pOp->p1);
+ }
+#endif
+ VdbeBranchTaken(0,3);
break;
}
- if( n<=0 ) break;
n--;
rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
- if( rc ) goto abort_due_to_error;
+ if( rc ){
+ if( rc==SQLITE_DONE ){
+ rc = SQLITE_OK;
+ goto seekscan_search_fail;
+ }else{
+ goto abort_due_to_error;
+ }
+ }
}
+
break;
}
diff --git a/src/wherecode.c b/src/wherecode.c
index 4e10c79d8d..9dbc1d4b00 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1807,7 +1807,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 ){
assert( op==OP_SeekGE );
assert( regBignull==0 );
- sqlite3VdbeAddOp1(v, OP_SeekScan, 10);
+ sqlite3VdbeAddOp1(v, OP_SeekScan, 10); VdbeCoverage(v);
}
sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
VdbeCoverage(v);
From a54e1b1fc88ecf0586de8d63a6287243097723dc Mon Sep 17 00:00:00 2001
From: drh
Date: Tue, 29 Sep 2020 23:52:25 +0000
Subject: [PATCH 082/169] The OP_SeekScan opcode is a no-op if the cursor is
not pointing to a valid row upon entry.
FossilOrigin-Name: 4afc96b5fe80bd192a23e0230edc207e641931c3bf48296b1a385c786386f1b7
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/vdbe.c | 10 ++++------
3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/manifest b/manifest
index d06d277e87..1fcaef7332 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Coverage\stesting\sof\sthe\sOP_SeekScan\sopcode.\s\sFix\sa\sproblem\sthat\scomes\sup\swhen\nOP_SeekScan\sreaches\sthe\send\sof\sthe\stable.
-D 2020-09-29T20:22:20.000
+C The\sOP_SeekScan\sopcode\sis\sa\sno-op\sif\sthe\scursor\sis\snot\spointing\sto\sa\svalid\nrow\supon\sentry.
+D 2020-09-29T23:52:25.083
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c a5f9dbd62905ce5f7fde94c4b6e9d24eeb0e1844a4f352d7ce7b447bad62afcb
+F src/vdbe.c 015caaa6afdce7cfa4f304b76cce6caaecc73c2fa36268d07de4df555dd33336
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -1880,7 +1880,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 6110fdd5bb7b4ae5c065404c802ae726362ef084966b73cffe58c4bfb98689d2
-R 5208a223b9abbea3e3bc1a7c83370262
+P 9e57e758a6a33f54d28a546b4eebfb5cfacef30dc4e0207e43bb9d2c06fc3439
+R 97102016c110374a118cc76eaed41921
U drh
-Z 4e19dcf82e793fd815f6f64707a372c6
+Z 93d2589fdb32de312517637854e5029b
diff --git a/manifest.uuid b/manifest.uuid
index bb134a3818..968a250973 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-9e57e758a6a33f54d28a546b4eebfb5cfacef30dc4e0207e43bb9d2c06fc3439
\ No newline at end of file
+4afc96b5fe80bd192a23e0230edc207e641931c3bf48296b1a385c786386f1b7
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index 3b52662468..c1952f2057 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4407,10 +4407,8 @@ seek_not_found:
** is the desired entry that we want the cursor SeekGE.P1 to be pointing
** to. Call this SeekGE.P4/P5 row the "target".
**
-** If the OP_SeekGE opcode that immediately follows this opcode has
-** never run before, which is to say if the SeekGE.P1 cursor is not pointing
-** to a valid raow, then this opcode is a no-op and control passes
-** through into the OP_SeekGE.
+** If the SeekGE.P1 cursor is not currently pointing to a valid row,
+** then this opcode is a no-op and control passes through into the OP_SeekGE.
**
** If the SeekGE.P1 cursor is pointing to a valid row, then that row
** might be the target row, or it might be near and slightly before the
@@ -4449,10 +4447,10 @@ case OP_SeekScan: {
assert( pC!=0 );
assert( pC->eCurType==CURTYPE_BTREE );
assert( !pC->isTable );
- if( pC->nullRow ){
+ if( !sqlite3BtreeCursorIsValidNN(pC->uc.pCursor) ){
#ifdef SQLITE_DEBUG
if( db->flags&SQLITE_VdbeTrace ){
- printf("... no prior seeks - fall through\n");
+ printf("... cursor not valid - fall through\n");
}
#endif
break;
From f287d0010880033a6b9745a351cac39c554fc591 Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 30 Sep 2020 00:10:22 +0000
Subject: [PATCH 083/169] In the OP_SeekScan opcode, changes to pOp must occur
after the call to VdbeBranchTaken() so that the VdbeBranchTaken() attributes
the branch to the correct opcode.
FossilOrigin-Name: 61fbe7aa7cc0e8fe3e6b1c5aec277183d8cd7c86b1e835c38e0b37a9b8063343
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/vdbe.c | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index 1fcaef7332..871a67bdbd 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C The\sOP_SeekScan\sopcode\sis\sa\sno-op\sif\sthe\scursor\sis\snot\spointing\sto\sa\svalid\nrow\supon\sentry.
-D 2020-09-29T23:52:25.083
+C In\sthe\sOP_SeekScan\sopcode,\schanges\sto\spOp\smust\soccur\safter\sthe\scall\nto\sVdbeBranchTaken()\sso\sthat\sthe\sVdbeBranchTaken()\sattributes\sthe\sbranch\nto\sthe\scorrect\sopcode.
+D 2020-09-30T00:10:22.499
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c 015caaa6afdce7cfa4f304b76cce6caaecc73c2fa36268d07de4df555dd33336
+F src/vdbe.c d3030d83fce74ba4678824a47f4d72e67dc26fd842ca64ff29a10efd1fd48551
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -1880,7 +1880,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 9e57e758a6a33f54d28a546b4eebfb5cfacef30dc4e0207e43bb9d2c06fc3439
-R 97102016c110374a118cc76eaed41921
+P 4afc96b5fe80bd192a23e0230edc207e641931c3bf48296b1a385c786386f1b7
+R 5eb606d017f17313f42a99e044d0774a
U drh
-Z 93d2589fdb32de312517637854e5029b
+Z 3b826fae3c541a8432a616bf2432412c
diff --git a/manifest.uuid b/manifest.uuid
index 968a250973..9b788a1462 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-4afc96b5fe80bd192a23e0230edc207e641931c3bf48296b1a385c786386f1b7
\ No newline at end of file
+61fbe7aa7cc0e8fe3e6b1c5aec277183d8cd7c86b1e835c38e0b37a9b8063343
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index c1952f2057..2c924abfea 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4481,8 +4481,8 @@ case OP_SeekScan: {
printf("... %d steps and then skip\n", pOp->p1 - n);
}
#endif
- pOp++;
VdbeBranchTaken(1,3);
+ pOp++;
goto jump_to_p2;
}
if( res==0 ){
@@ -4491,8 +4491,8 @@ case OP_SeekScan: {
printf("... %d steps and then success\n", pOp->p1 - n);
}
#endif
- pOp += 2;
VdbeBranchTaken(2,3);
+ pOp += 2;
break;
}
if( n<=0 ){
From a957e22fa4d54628b6ee991c44cce1f129ee26cd Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 30 Sep 2020 00:48:45 +0000
Subject: [PATCH 084/169] Add an sqlite3FaultSim() call to btreeNext() to make
it easier to simulate I/O errors in calls to sqlite3BtreeNext(), and in
OP_SeekScan.
FossilOrigin-Name: 29cca775d3f5411624f0a8d55d34a038a24f1009d25b097315adb64e70c4b299
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/btree.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 871a67bdbd..20b2626f99 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\sOP_SeekScan\sopcode,\schanges\sto\spOp\smust\soccur\safter\sthe\scall\nto\sVdbeBranchTaken()\sso\sthat\sthe\sVdbeBranchTaken()\sattributes\sthe\sbranch\nto\sthe\scorrect\sopcode.
-D 2020-09-30T00:10:22.499
+C Add\san\ssqlite3FaultSim()\scall\sto\sbtreeNext()\sto\smake\sit\seasier\sto\nsimulate\sI/O\serrors\sin\scalls\sto\ssqlite3BtreeNext(),\sand\sin\sOP_SeekScan.
+D 2020-09-30T00:48:45.754
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -476,7 +476,7 @@ F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06
F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
-F src/btree.c 1fbb15cf6af2ccd4bc784f52bda7e6a860e303d677587b6a4b95d72ae36480a0
+F src/btree.c c678de5bf6f57933e0ad40578fbdb0fc8113b414bf517e0a2525cb319c379874
F src/btree.h c64f1439377e2edf31f7c3a562586a96b71f8d0ca47e65756e7d122fd8f06928
F src/btreeInt.h ffd66480520d9d70222171b3a026d78b80833b5cea49c89867949f3e023d5f43
F src/build.c 55faabe78044063eae7d1cb3767afa1bafd6edc41d950b6e2228abf601f87912
@@ -1880,7 +1880,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 4afc96b5fe80bd192a23e0230edc207e641931c3bf48296b1a385c786386f1b7
-R 5eb606d017f17313f42a99e044d0774a
+P 61fbe7aa7cc0e8fe3e6b1c5aec277183d8cd7c86b1e835c38e0b37a9b8063343
+R 0b2a622435f87f89b0d6a9c8ee522f7c
U drh
-Z 3b826fae3c541a8432a616bf2432412c
+Z 26cac2281ed8a0b988e6ac47b2309f54
diff --git a/manifest.uuid b/manifest.uuid
index 9b788a1462..fa007f4f56 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-61fbe7aa7cc0e8fe3e6b1c5aec277183d8cd7c86b1e835c38e0b37a9b8063343
\ No newline at end of file
+29cca775d3f5411624f0a8d55d34a038a24f1009d25b097315adb64e70c4b299
\ No newline at end of file
diff --git a/src/btree.c b/src/btree.c
index 7f1a15198b..00e5da6c48 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -5750,7 +5750,7 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){
pPage = pCur->pPage;
idx = ++pCur->ix;
- if( !pPage->isInit ){
+ if( !pPage->isInit || sqlite3FaultSim(412) ){
/* The only known way for this to happen is for there to be a
** recursive SQL function that does a DELETE operation as part of a
** SELECT which deletes content out from under an active cursor
From 1e6c58dee291617e85fe1ef056d5d36bd5b6a5f2 Mon Sep 17 00:00:00 2001
From: shearer
Date: Wed, 30 Sep 2020 09:17:53 +0000
Subject: [PATCH 085/169] Better understanding of savepoint code
FossilOrigin-Name: ce6d8d621505f25e4fd43e7cf27445e1a2ddd58d79108d63499c2ae30cc9f610
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/btree.h | 9 +++++++++
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 96eacb42ae..163e59c596 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Small\sperformance\simprovement\sand\ssize\sreduction\sby\sreducing\sthe\ssize\sof\nthe\sWhereTerm\sobject.
-D 2020-09-28T15:49:43.021
+C Better\sunderstanding\sof\ssavepoint\scode
+D 2020-09-30T09:17:53.809
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -477,7 +477,7 @@ F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 1fbb15cf6af2ccd4bc784f52bda7e6a860e303d677587b6a4b95d72ae36480a0
-F src/btree.h c64f1439377e2edf31f7c3a562586a96b71f8d0ca47e65756e7d122fd8f06928
+F src/btree.h dcdff4037d75b3f032a5de0d922fcfaf35d48589417f634fa8627362709315f9
F src/btreeInt.h ffd66480520d9d70222171b3a026d78b80833b5cea49c89867949f3e023d5f43
F src/build.c 55faabe78044063eae7d1cb3767afa1bafd6edc41d950b6e2228abf601f87912
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
@@ -1880,7 +1880,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 d3d13df31a97648f952beb2e1a783f947a80ec843227985ad9ebd14452d2f654
-R 7b8c3cb46dfe068597bdde1b75906671
-U drh
-Z d72bcf93f915317cb95885e250422e3c
+P 43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
+R b1f87b32877c4403d4ed1f228646d266
+U shearer
+Z 31a184db4475ad0cfaf0375a949ed5dd
diff --git a/manifest.uuid b/manifest.uuid
index f071ea53f6..01430f8201 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
\ No newline at end of file
+ce6d8d621505f25e4fd43e7cf27445e1a2ddd58d79108d63499c2ae30cc9f610
\ No newline at end of file
diff --git a/src/btree.h b/src/btree.h
index 4cfa685856..7a9ed2e3c6 100644
--- a/src/btree.h
+++ b/src/btree.h
@@ -87,13 +87,22 @@ int sqlite3BtreeBeginStmt(Btree*,int);
int sqlite3BtreeCreateTable(Btree*, Pgno*, int flags);
int sqlite3BtreeTxnState(Btree*);
int sqlite3BtreeIsInBackup(Btree*);
+
void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
int sqlite3BtreeSchemaLocked(Btree *pBtree);
#ifndef SQLITE_OMIT_SHARED_CACHE
int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock);
#endif
+
+/* Savepoints are named, nestable SQL transactions mostly implemented */
+/* in vdbe.c and pager.c See https://sqlite.org/lang_savepoint.html */
int sqlite3BtreeSavepoint(Btree *, int, int);
+/* "Checkpoint" only refers to WAL. See https://sqlite.org/wal.html#ckpt */
+#ifndef SQLITE_OMIT_WAL
+ int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
+#endif
+
const char *sqlite3BtreeGetFilename(Btree *);
const char *sqlite3BtreeGetJournalname(Btree *);
int sqlite3BtreeCopyFile(Btree *, Btree *);
From af3711536b96e90ab11d8181819f90be371a4689 Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 30 Sep 2020 15:36:03 +0000
Subject: [PATCH 086/169] In the query flattener when substituting expression Y
in place of expression X, if X is marked has having come from an ON or USING
clause of a LEFT JOIN, then be sure that all subexpressions of Y, not just
the root node of Y, are similarly marked. Otherwise, if Y is an AND
operator, it will be split up during WHERE clause analysis and the
subexpressions will not get the special treatment needed by LEFT JOIN
ON/USING clauses. Fix for ticket [66e4b0e271c47145].
FossilOrigin-Name: 69f9eb7343a416c5ab426c8e1b9f0ae576544b4ccc5d87f5481c8ff884f696e1
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
src/select.c | 3 +--
test/join.test | 15 ++++++++++++++-
4 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/manifest b/manifest
index 163e59c596..e4c10a1814 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Better\sunderstanding\sof\ssavepoint\scode
-D 2020-09-30T09:17:53.809
+C In\sthe\squery\sflattener\swhen\ssubstituting\sexpression\sY\sin\splace\sof\sexpression\sX,\nif\sX\sis\smarked\shas\shaving\scome\sfrom\san\sON\sor\sUSING\sclause\sof\sa\sLEFT\sJOIN,\sthen\nbe\ssure\sthat\sall\ssubexpressions\sof\sY,\snot\sjust\sthe\sroot\snode\sof\sY,\sare\nsimilarly\smarked.\s\sOtherwise,\sif\sY\sis\san\sAND\soperator,\sit\swill\sbe\ssplit\sup\nduring\sWHERE\sclause\sanalysis\sand\sthe\ssubexpressions\swill\snot\sget\sthe\sspecial\ntreatment\sneeded\sby\sLEFT\sJOIN\sON/USING\sclauses.\nFix\sfor\sticket\s[66e4b0e271c47145].
+D 2020-09-30T15:36:03.192
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -535,7 +535,7 @@ F src/printf.c 30e92b638fac71dcd85cdea1d12ecfae354c9adee2c71e8e1ae4727cde7c91ed
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
-F src/select.c 6c3f7d60295f06ce7fa128bb23b1159648f0aa96a78c257af35dfef727ac63f1
+F src/select.c 0d9ce195bf062f45390c9f9fa0ab7402e26b57bee51b9f67b3034c32f9fc425a
F src/shell.c.in 4e6ea7bf44ace40faf2b4214b7cb336fd15d22d2f7d04b70b5aa10a7716f7be7
F src/sqlite.h.in cb9f0862e8d0f8691de95b18439ab60666f868c83bc65e3a17f0a0b44cc8f8a9
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
@@ -1102,7 +1102,7 @@ F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c
F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b
F test/istrue.test 9619a2d77580f676048aaff7a16a0bcfea2b96c6c660dfaded2e53c873418899
-F test/join.test bca044589e94bb466e4c1e91fb6fecdc3f3326ca6b3f590f555f1958156eb321
+F test/join.test 25da4f53523a4aa17c893134b47fba6aa4799bb33350517b157785878290e238
F test/join2.test 21fc30e54ab35ed66bf51b89cec18729205497f5cc43c83bc042f96a73721593
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
@@ -1880,7 +1880,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 43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
-R b1f87b32877c4403d4ed1f228646d266
-U shearer
-Z 31a184db4475ad0cfaf0375a949ed5dd
+P ce6d8d621505f25e4fd43e7cf27445e1a2ddd58d79108d63499c2ae30cc9f610
+R ca5748dca083fba63e24d1a1feb3742c
+U drh
+Z e1c26467ce86b385fbc5e8735c1d70ec
diff --git a/manifest.uuid b/manifest.uuid
index 01430f8201..c64680badf 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-ce6d8d621505f25e4fd43e7cf27445e1a2ddd58d79108d63499c2ae30cc9f610
\ No newline at end of file
+69f9eb7343a416c5ab426c8e1b9f0ae576544b4ccc5d87f5481c8ff884f696e1
\ No newline at end of file
diff --git a/src/select.c b/src/select.c
index 535f883a17..acbd17ca87 100644
--- a/src/select.c
+++ b/src/select.c
@@ -3515,8 +3515,7 @@ static Expr *substExpr(
ExprSetProperty(pNew, EP_CanBeNull);
}
if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
- pNew->iRightJoinTable = pExpr->iRightJoinTable;
- ExprSetProperty(pNew, EP_FromJoin);
+ sqlite3SetJoinExpr(pNew, pExpr->iRightJoinTable);
}
sqlite3ExprDelete(db, pExpr);
pExpr = pNew;
diff --git a/test/join.test b/test/join.test
index 75f311b86b..cb3ccc65d5 100644
--- a/test/join.test
+++ b/test/join.test
@@ -1025,5 +1025,18 @@ do_execsql_test join-24.2 {
SELECT * FROM t2 LEFT JOIN t1 ON a=0 WHERE (x='x' OR x IS NULL);
} {1 {} {}}
-finish_test
+# 2020-09-30 ticket 66e4b0e271c47145
+# The query flattener inserts an "expr AND expr" expression as a substitution
+# for the column of a view where that view column is part of an ON expression
+# of a LEFT JOIN.
+#
+reset_db
+do_execsql_test join-25.1 {
+ CREATE TABLE t0(c0 INT);
+ CREATE VIEW v0 AS SELECT (NULL AND 5) as c0 FROM t0;
+ INSERT INTO t0(c0) VALUES (NULL);
+ SELECT count(*) FROM v0 LEFT JOIN t0 ON v0.c0;
+} {1}
+
+finish_test
From 395a60dad467819ba520aa528dd4983e908c50ec Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 30 Sep 2020 17:32:22 +0000
Subject: [PATCH 087/169] Back out the incorrect optimization of check-in
[e51ecadcbdef5ce6] as ticket [5c4e7aa793943803] reports a case where the
optimization does not work.
FossilOrigin-Name: 7395e96b8cc370c8ac2657fb805915b0992a15d80f8bf256d277b423fec64675
---
manifest | 15 ++++++++-------
manifest.uuid | 2 +-
src/wherecode.c | 6 ++----
test/null.test | 7 +++++++
4 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/manifest b/manifest
index e4c10a1814..5d4357f4dc 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\squery\sflattener\swhen\ssubstituting\sexpression\sY\sin\splace\sof\sexpression\sX,\nif\sX\sis\smarked\shas\shaving\scome\sfrom\san\sON\sor\sUSING\sclause\sof\sa\sLEFT\sJOIN,\sthen\nbe\ssure\sthat\sall\ssubexpressions\sof\sY,\snot\sjust\sthe\sroot\snode\sof\sY,\sare\nsimilarly\smarked.\s\sOtherwise,\sif\sY\sis\san\sAND\soperator,\sit\swill\sbe\ssplit\sup\nduring\sWHERE\sclause\sanalysis\sand\sthe\ssubexpressions\swill\snot\sget\sthe\sspecial\ntreatment\sneeded\sby\sLEFT\sJOIN\sON/USING\sclauses.\nFix\sfor\sticket\s[66e4b0e271c47145].
-D 2020-09-30T15:36:03.192
+C Back\sout\sthe\sincorrect\soptimization\sof\scheck-in\s[e51ecadcbdef5ce6]\sas\nticket\s[5c4e7aa793943803]\sreports\sa\scase\swhere\sthe\soptimization\sdoes\snot\nwork.
+D 2020-09-30T17:32:22.269
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c 7ed6512e73e679231ebdeba470055e8d8e871a020b7f3f8dc75e993aaebdcbcd
F src/whereInt.h db7472b6eb617b5853ae74bbd755383e2275be72ae03ff07cc8ea141bb146dc8
-F src/wherecode.c 895ff782a62370a823c99dc7e1bca09ffd90392c9fafc007b6d3df4811e88b4f
+F src/wherecode.c 13a212b333b53ded7732f6497fbb3cd01b57dc864baa9b43fbf12f13c31ce02c
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1207,7 +1207,7 @@ F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf
F test/notify2.test 2ecabaa1305083856b7c39cf32816b612740c161
F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934
F test/notnull.test a37b663d5bb728d66fc182016613fb8e4a0a4bbf3d75b8876a7527f7d4ed3f18
-F test/null.test 0dcce4f04284ec66108c503327ad6d224c0752b3
+F test/null.test b7ff206a1c60fe01aa2abd33ef9ea83c93727d993ca8a613de86e925c9f2bc6f
F test/nulls1.test 82c5bc33148405f21205865abf13c786084438d573a4ac4e87e11b6091cde526
F test/numcast.test 5d126f7f581432e86a90d1e35cac625164aec4a1
F test/numindex1.test 20a5450d4b056e48cd5db30e659f13347a099823
@@ -1880,7 +1880,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 ce6d8d621505f25e4fd43e7cf27445e1a2ddd58d79108d63499c2ae30cc9f610
-R ca5748dca083fba63e24d1a1feb3742c
+P 69f9eb7343a416c5ab426c8e1b9f0ae576544b4ccc5d87f5481c8ff884f696e1
+Q -e51ecadcbdef5ce6e41d68412aee70aa4a1416c850358a6fa7e9a1ab443e719d
+R d888f761f75b8b1e3625e0c4f85e8209
U drh
-Z e1c26467ce86b385fbc5e8735c1d70ec
+Z a5f3d5d526894c5d84b026a8e4ccec60
diff --git a/manifest.uuid b/manifest.uuid
index c64680badf..9cb067398d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-69f9eb7343a416c5ab426c8e1b9f0ae576544b4ccc5d87f5481c8ff884f696e1
\ No newline at end of file
+7395e96b8cc370c8ac2657fb805915b0992a15d80f8bf256d277b423fec64675
\ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index e3310b314e..33482f496a 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1763,8 +1763,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
Expr *pRight = pRangeStart->pExpr->pRight;
codeExprOrVector(pParse, pRight, regBase+nEq, nBtm);
whereLikeOptimizationStringFixup(v, pLevel, pRangeStart);
- if( !bRev
- && (pRangeStart->wtFlags & TERM_VNULL)==0
+ if( (pRangeStart->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
@@ -1839,8 +1838,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
Expr *pRight = pRangeEnd->pExpr->pRight;
codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
- if( bRev
- && (pRangeEnd->wtFlags & TERM_VNULL)==0
+ if( (pRangeEnd->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
diff --git a/test/null.test b/test/null.test
index e8eeb9740b..5057e2537e 100644
--- a/test/null.test
+++ b/test/null.test
@@ -296,5 +296,12 @@ do_execsql_test null-9.3 {
SELECT * FROM t5 WHERE a IS NULL AND b = 'x';
} {{} x two {} x ii}
+# 2020-09-30 ticket 5c4e7aa793943803
+reset_db
+do_execsql_test null-10.1 {
+ CREATE TABLE t0(c0 PRIMARY KEY DESC);
+ INSERT INTO t0(c0) VALUES (0);
+ SELECT * FROM t0 WHERE t0.c0 > NULL;
+} {}
finish_test
From 4f65b3bbfb2205dba20740d0b31c83fbc81f8931 Mon Sep 17 00:00:00 2001
From: drh
Date: Wed, 30 Sep 2020 18:03:22 +0000
Subject: [PATCH 088/169] For the OP_SeekScan opcode, adjust the number of
steps run before giving up based on the estimated number of comparisons
needed to perform a seek.
FossilOrigin-Name: dc4172e6b8e1f62dc7329a3adb2223f290bc4c8055c265e88182ef432f4bcf10
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/wherecode.c | 11 ++++++++++-
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 20b2626f99..59691be9f5 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\san\ssqlite3FaultSim()\scall\sto\sbtreeNext()\sto\smake\sit\seasier\sto\nsimulate\sI/O\serrors\sin\scalls\sto\ssqlite3BtreeNext(),\sand\sin\sOP_SeekScan.
-D 2020-09-30T00:48:45.754
+C For\sthe\sOP_SeekScan\sopcode,\sadjust\sthe\snumber\sof\ssteps\srun\sbefore\sgiving\nup\sbased\son\sthe\sestimated\snumber\sof\scomparisons\sneeded\sto\sperform\sa\sseek.
+D 2020-09-30T18:03:22.696
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c da9c0d503f81cc8444eb3525b75eec2bb3d198f4d5939b207977f2fc20d85b54
F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
-F src/wherecode.c 8d5e5973bcb5348877ac07ec85fb98cc3bb3b3377b79845cb39b3e812194cc47
+F src/wherecode.c ccaedd1965710e9ae35beaea59ac0ae08eb3562ab33b3a4190624b62a2e73338
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1880,7 +1880,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 61fbe7aa7cc0e8fe3e6b1c5aec277183d8cd7c86b1e835c38e0b37a9b8063343
-R 0b2a622435f87f89b0d6a9c8ee522f7c
+P 29cca775d3f5411624f0a8d55d34a038a24f1009d25b097315adb64e70c4b299
+R d48dd14bce0cf72df7149cdfd5f0b155
U drh
-Z 26cac2281ed8a0b988e6ac47b2309f54
+Z 0a6d09a4ef2f63f11f949f8dfc05337e
diff --git a/manifest.uuid b/manifest.uuid
index fa007f4f56..42e169af85 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-29cca775d3f5411624f0a8d55d34a038a24f1009d25b097315adb64e70c4b299
\ No newline at end of file
+dc4172e6b8e1f62dc7329a3adb2223f290bc4c8055c265e88182ef432f4bcf10
\ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index 9dbc1d4b00..5a17130e0b 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1807,7 +1807,16 @@ Bitmask sqlite3WhereCodeOneLoopStart(
if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 ){
assert( op==OP_SeekGE );
assert( regBignull==0 );
- sqlite3VdbeAddOp1(v, OP_SeekScan, 10); VdbeCoverage(v);
+ /* TUNING: The OP_SeekScan opcode seeks to reduce the number
+ ** of expensive seek operations by replacing a single seek with
+ ** 1 or more step operations. The question is, how many steps
+ ** should we try before giving up and going with a seek. The cost
+ ** of a seek is proportional to the logarithm of the of the number
+ ** of entries in the tree, so basing the number of steps to try
+ ** on the estimated number of rows in the btree seems like a good
+ ** guess. */
+ sqlite3VdbeAddOp1(v, OP_SeekScan, (pIdx->aiRowLogEst[0]+9)/10);
+ VdbeCoverage(v);
}
sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
VdbeCoverage(v);
From 33a99fad081909d26687557b49ffe45d372a8a70 Mon Sep 17 00:00:00 2001
From: dan
Date: Wed, 30 Sep 2020 20:35:37 +0000
Subject: [PATCH 089/169] Add experimental unicode-aware trigram tokenizer to
fts5. And support for LIKE and GLOB optimizations for fts5 tables that use
said tokenizer.
FossilOrigin-Name: 0d7810c1aea93c0a3da1ccc4911dbce8a1b6e1dbfe1ab7e800289a0c783b5985
---
ext/fts5/fts5Int.h | 20 ++++--
ext/fts5/fts5_config.c | 6 +-
ext/fts5/fts5_expr.c | 60 ++++++++++++++++
ext/fts5/fts5_main.c | 92 +++++++++++++++----------
ext/fts5/fts5_tokenize.c | 113 ++++++++++++++++++++++++++++++
ext/fts5/test/fts5plan.test | 4 +-
ext/fts5/test/fts5trigram.test | 121 +++++++++++++++++++++++++++++++++
manifest | 29 ++++----
manifest.uuid | 2 +-
9 files changed, 385 insertions(+), 62 deletions(-)
create mode 100644 ext/fts5/test/fts5trigram.test
diff --git a/ext/fts5/fts5Int.h b/ext/fts5/fts5Int.h
index 364a5c6de8..1860381cea 100644
--- a/ext/fts5/fts5Int.h
+++ b/ext/fts5/fts5Int.h
@@ -184,6 +184,7 @@ struct Fts5Config {
Fts5Tokenizer *pTok;
fts5_tokenizer *pTokApi;
int bLock; /* True when table is preparing statement */
+ int ePattern; /* FTS_PATTERN_XXX constant */
/* Values loaded from the %_config table */
int iCookie; /* Incremented when %_config is modified */
@@ -204,17 +205,19 @@ struct Fts5Config {
};
/* Current expected value of %_config table 'version' field */
-#define FTS5_CURRENT_VERSION 4
+#define FTS5_CURRENT_VERSION 4
#define FTS5_CONTENT_NORMAL 0
#define FTS5_CONTENT_NONE 1
#define FTS5_CONTENT_EXTERNAL 2
-#define FTS5_DETAIL_FULL 0
-#define FTS5_DETAIL_NONE 1
-#define FTS5_DETAIL_COLUMNS 2
-
+#define FTS5_DETAIL_FULL 0
+#define FTS5_DETAIL_NONE 1
+#define FTS5_DETAIL_COLUMNS 2
+#define FTS5_PATTERN_NONE 0
+#define FTS5_PATTERN_LIKE 65 /* matches SQLITE_INDEX_CONSTRAINT_LIKE */
+#define FTS5_PATTERN_GLOB 66 /* matches SQLITE_INDEX_CONSTRAINT_GLOB */
int sqlite3Fts5ConfigParse(
Fts5Global*, sqlite3*, int, const char **, Fts5Config**, char**
@@ -554,8 +557,7 @@ int sqlite3Fts5GetTokenizer(
Fts5Global*,
const char **azArg,
int nArg,
- Fts5Tokenizer**,
- fts5_tokenizer**,
+ Fts5Config*,
char **pzErr
);
@@ -797,6 +799,10 @@ int sqlite3Fts5AuxInit(fts5_api*);
*/
int sqlite3Fts5TokenizerInit(fts5_api*);
+int sqlite3Fts5TokenizerPattern(
+ int (*xCreate)(void*, const char**, int, Fts5Tokenizer**),
+ Fts5Tokenizer *pTok
+);
/*
** End of interface to code in fts5_tokenizer.c.
**************************************************************************/
diff --git a/ext/fts5/fts5_config.c b/ext/fts5/fts5_config.c
index ddd2317974..6c02d2b35f 100644
--- a/ext/fts5/fts5_config.c
+++ b/ext/fts5/fts5_config.c
@@ -325,7 +325,7 @@ static int fts5ConfigParseSpecial(
rc = SQLITE_ERROR;
}else{
rc = sqlite3Fts5GetTokenizer(pGlobal,
- (const char**)azArg, (int)nArg, &pConfig->pTok, &pConfig->pTokApi,
+ (const char**)azArg, (int)nArg, pConfig,
pzErr
);
}
@@ -397,9 +397,7 @@ static int fts5ConfigParseSpecial(
*/
static int fts5ConfigDefaultTokenizer(Fts5Global *pGlobal, Fts5Config *pConfig){
assert( pConfig->pTok==0 && pConfig->pTokApi==0 );
- return sqlite3Fts5GetTokenizer(
- pGlobal, 0, 0, &pConfig->pTok, &pConfig->pTokApi, 0
- );
+ return sqlite3Fts5GetTokenizer(pGlobal, 0, 0, pConfig, 0);
}
/*
diff --git a/ext/fts5/fts5_expr.c b/ext/fts5/fts5_expr.c
index 40d15ec170..68d3b6e87e 100644
--- a/ext/fts5/fts5_expr.c
+++ b/ext/fts5/fts5_expr.c
@@ -284,6 +284,66 @@ int sqlite3Fts5ExprNew(
return sParse.rc;
}
+int sqlite3Fts5ExprPattern(
+ Fts5Config *pConfig, int iCol, const char *zText, Fts5Expr **pp
+){
+ i64 nText = strlen(zText);
+ char *zExpr = (char*)sqlite3_malloc64(nText*4 + 1);
+ int rc = SQLITE_OK;
+
+ if( zExpr==0 ){
+ rc = SQLITE_NOMEM;
+ }else{
+ char aSpec[3];
+ int iOut = 0;
+ int i = 0;
+ int iFirst = 0;
+
+ if( pConfig->ePattern==FTS5_PATTERN_LIKE ){
+ aSpec[0] = '_';
+ aSpec[1] = '%';
+ aSpec[2] = 0;
+ }else{
+ aSpec[0] = '*';
+ aSpec[1] = '?';
+ aSpec[2] = '[';
+ }
+
+ while( i<=nText ){
+ if( i==nText
+ || zText[i]==aSpec[0] || zText[i]==aSpec[1] || zText[i]==aSpec[2]
+ ){
+ if( i-iFirst>=3 ){
+ int jj;
+ zExpr[iOut++] = '"';
+ for(jj=iFirst; jj0 ){
+ zExpr[iOut] = '\0';
+ rc = sqlite3Fts5ExprNew(pConfig, iCol, zExpr, pp, pConfig->pzErrmsg);
+ }else{
+ *pp = 0;
+ }
+ sqlite3_free(zExpr);
+ }
+
+ return rc;
+}
+
/*
** Free the expression node object passed as the only argument.
*/
diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c
index 80901de078..b1163a4d16 100644
--- a/ext/fts5/fts5_main.c
+++ b/ext/fts5/fts5_main.c
@@ -493,7 +493,9 @@ static void fts5SetUniqueFlag(sqlite3_index_info *pIdxInfo){
**
** Match against table column: "m"
** Match against rank column: "r"
-** Match against other column: ""
+** Match against other column: "M"
+** LIKE against other column: "L"
+** GLOB against other column: "G"
** Equality constraint against the rowid: "="
** A < or <= against the rowid: "<"
** A > or >= against the rowid: ">"
@@ -554,7 +556,7 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
return SQLITE_ERROR;
}
- idxStr = (char*)sqlite3_malloc(pInfo->nConstraint * 6 + 1);
+ idxStr = (char*)sqlite3_malloc(pInfo->nConstraint * 8 + 1);
if( idxStr==0 ) return SQLITE_NOMEM;
pInfo->idxStr = idxStr;
pInfo->needToFreeIdxStr = 1;
@@ -578,25 +580,29 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
if( bSeenRank ) continue;
idxStr[iIdxStr++] = 'r';
bSeenRank = 1;
- }else{
+ }else if( iCol>=0 ){
bSeenMatch = 1;
- idxStr[iIdxStr++] = 'm';
- if( iColaConstraintUsage[i].argvIndex = ++iCons;
pInfo->aConstraintUsage[i].omit = 1;
}
- }
- else if( p->usable && bSeenEq==0
- && p->op==SQLITE_INDEX_CONSTRAINT_EQ && iCol<0
- ){
- idxStr[iIdxStr++] = '=';
- bSeenEq = 1;
- pInfo->aConstraintUsage[i].argvIndex = ++iCons;
+ }else if( p->usable ){
+ if( iCol>=0 && iColePattern==p->op ){
+ assert( p->op==FTS5_PATTERN_LIKE || p->op==FTS5_PATTERN_GLOB );
+ idxStr[iIdxStr++] = p->op==FTS5_PATTERN_LIKE ? 'L' : 'G';
+ sqlite3_snprintf(6, &idxStr[iIdxStr], "%d", iCol);
+ idxStr += strlen(&idxStr[iIdxStr]);
+ pInfo->aConstraintUsage[i].argvIndex = ++iCons;
+ assert( idxStr[iIdxStr]=='\0' );
+ }else if( bSeenEq==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ && iCol<0 ){
+ idxStr[iIdxStr++] = '=';
+ bSeenEq = 1;
+ pInfo->aConstraintUsage[i].argvIndex = ++iCons;
+ }
}
}
@@ -1229,19 +1235,14 @@ static int fts5FilterMethod(
case 'r':
pRank = apVal[i];
break;
- case 'm': {
+ case 'M': {
const char *zText = (const char*)sqlite3_value_text(apVal[i]);
if( zText==0 ) zText = "";
-
- if( idxStr[iIdxStr]>='0' && idxStr[iIdxStr]<='9' ){
- iCol = 0;
- do{
- iCol = iCol*10 + (idxStr[iIdxStr]-'0');
- iIdxStr++;
- }while( idxStr[iIdxStr]>='0' && idxStr[iIdxStr]<='9' );
- }else{
- iCol = pConfig->nCol;
- }
+ iCol = 0;
+ do{
+ iCol = iCol*10 + (idxStr[iIdxStr]-'0');
+ iIdxStr++;
+ }while( idxStr[iIdxStr]>='0' && idxStr[iIdxStr]<='9' );
if( zText[0]=='*' ){
/* The user has issued a query of the form "MATCH '*...'". This
@@ -1261,6 +1262,22 @@ static int fts5FilterMethod(
break;
}
+ case 'L':
+ case 'G': {
+ const char *zText = (const char*)sqlite3_value_text(apVal[i]);
+ iCol = 0;
+ do{
+ iCol = iCol*10 + (idxStr[iIdxStr]-'0');
+ iIdxStr++;
+ }while( idxStr[iIdxStr]>='0' && idxStr[iIdxStr]<='9' );
+ rc = sqlite3Fts5ExprPattern(pConfig, iCol, zText, &pExpr);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3Fts5ExprAnd(&pCsr->pExpr, pExpr);
+ pExpr = 0;
+ }
+ if( rc!=SQLITE_OK ) goto filter_out;
+ break;
+ }
case '=':
pRowidEq = apVal[i];
break;
@@ -2672,8 +2689,7 @@ int sqlite3Fts5GetTokenizer(
Fts5Global *pGlobal,
const char **azArg,
int nArg,
- Fts5Tokenizer **ppTok,
- fts5_tokenizer **ppTokApi,
+ Fts5Config *pConfig,
char **pzErr
){
Fts5TokenizerModule *pMod;
@@ -2685,16 +2701,22 @@ int sqlite3Fts5GetTokenizer(
rc = SQLITE_ERROR;
*pzErr = sqlite3_mprintf("no such tokenizer: %s", azArg[0]);
}else{
- rc = pMod->x.xCreate(pMod->pUserData, &azArg[1], (nArg?nArg-1:0), ppTok);
- *ppTokApi = &pMod->x;
- if( rc!=SQLITE_OK && pzErr ){
- *pzErr = sqlite3_mprintf("error in tokenizer constructor");
+ rc = pMod->x.xCreate(
+ pMod->pUserData, &azArg[1], (nArg?nArg-1:0), &pConfig->pTok
+ );
+ pConfig->pTokApi = &pMod->x;
+ if( rc!=SQLITE_OK ){
+ if( pzErr ) *pzErr = sqlite3_mprintf("error in tokenizer constructor");
+ }else{
+ pConfig->ePattern = sqlite3Fts5TokenizerPattern(
+ pMod->x.xCreate, pConfig->pTok
+ );
}
}
if( rc!=SQLITE_OK ){
- *ppTokApi = 0;
- *ppTok = 0;
+ pConfig->pTokApi = 0;
+ pConfig->pTok = 0;
}
return rc;
diff --git a/ext/fts5/fts5_tokenize.c b/ext/fts5/fts5_tokenize.c
index 93edcee133..b3c3995504 100644
--- a/ext/fts5/fts5_tokenize.c
+++ b/ext/fts5/fts5_tokenize.c
@@ -1258,6 +1258,118 @@ static int fts5PorterTokenize(
);
}
+/**************************************************************************
+** Start of trigram implementation.
+*/
+
+typedef struct TrigramTokenizer TrigramTokenizer;
+struct TrigramTokenizer {
+ int bFold;
+};
+
+/*
+** Free a trigram tokenizer.
+*/
+static void fts5TriDelete(Fts5Tokenizer *p){
+ sqlite3_free(p);
+}
+
+/*
+** Allocate a trigram tokenizer.
+*/
+static int fts5TriCreate(
+ void *pCtx,
+ const char **azArg,
+ int nArg,
+ Fts5Tokenizer **ppOut
+){
+ int rc = SQLITE_OK;
+ TrigramTokenizer *pNew = (TrigramTokenizer*)sqlite3_malloc(sizeof(*pNew));
+ if( pNew==0 ){
+ rc = SQLITE_NOMEM;
+ }else{
+ int i;
+ pNew->bFold = 1;
+ for(i=0; rc==SQLITE_OK && ibFold = (zArg[0]=='0');
+ }
+ }else{
+ rc = SQLITE_ERROR;
+ }
+ }
+ if( rc!=SQLITE_OK ){
+ fts5TriDelete((Fts5Tokenizer*)pNew);
+ pNew = 0;
+ }
+ }
+ *ppOut = (Fts5Tokenizer*)pNew;
+ return rc;
+}
+
+/*
+** Trigram tokenizer tokenize routine.
+*/
+static int fts5TriTokenize(
+ Fts5Tokenizer *pTok,
+ void *pCtx,
+ int flags,
+ const char *pText, int nText,
+ int (*xToken)(void*, int, const char*, int, int, int)
+){
+ TrigramTokenizer *p = (TrigramTokenizer*)pTok;
+ int rc = SQLITE_OK;
+ char aBuf[32];
+ const unsigned char *zIn = (const unsigned char*)pText;
+ const unsigned char *zEof = &zIn[nText];
+ u32 iCode;
+
+ while( 1 ){
+ char *zOut = aBuf;
+ int iStart = zIn - (const unsigned char*)pText;
+ const unsigned char *zNext;
+
+ READ_UTF8(zIn, zEof, iCode);
+ zNext = zIn;
+ if( zInbFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0);
+ WRITE_UTF8(zOut, iCode);
+ READ_UTF8(zIn, zEof, iCode);
+ }else{
+ break;
+ }
+ if( zInbFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0);
+ WRITE_UTF8(zOut, iCode);
+ READ_UTF8(zIn, zEof, iCode);
+ if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0);
+ WRITE_UTF8(zOut, iCode);
+ }else{
+ break;
+ }
+ rc = xToken(pCtx, 0, aBuf, zOut-aBuf, iStart, iStart + zOut-aBuf);
+ if( rc!=SQLITE_OK ) break;
+ zIn = zNext;
+ }
+
+ return rc;
+}
+
+int sqlite3Fts5TokenizerPattern(
+ int (*xCreate)(void*, const char**, int, Fts5Tokenizer**),
+ Fts5Tokenizer *pTok
+){
+ if( xCreate==fts5TriCreate ){
+ TrigramTokenizer *p = (TrigramTokenizer*)pTok;
+ return p->bFold ? FTS5_PATTERN_LIKE : FTS5_PATTERN_GLOB;
+ }
+ return FTS5_PATTERN_NONE;
+}
+
/*
** Register all built-in tokenizers with FTS5.
*/
@@ -1269,6 +1381,7 @@ int sqlite3Fts5TokenizerInit(fts5_api *pApi){
{ "unicode61", {fts5UnicodeCreate, fts5UnicodeDelete, fts5UnicodeTokenize}},
{ "ascii", {fts5AsciiCreate, fts5AsciiDelete, fts5AsciiTokenize }},
{ "porter", {fts5PorterCreate, fts5PorterDelete, fts5PorterTokenize }},
+ { "trigram", {fts5TriCreate, fts5TriDelete, fts5TriTokenize}},
};
int rc = SQLITE_OK; /* Return code */
diff --git a/ext/fts5/test/fts5plan.test b/ext/fts5/test/fts5plan.test
index 46ac234ff7..7118427a2b 100644
--- a/ext/fts5/test/fts5plan.test
+++ b/ext/fts5/test/fts5plan.test
@@ -31,7 +31,7 @@ do_eqp_test 1.1 {
} {
QUERY PLAN
|--SCAN TABLE t1
- `--SCAN TABLE f1 VIRTUAL TABLE INDEX 0:m
+ `--SCAN TABLE f1 VIRTUAL TABLE INDEX 0:M1
}
do_eqp_test 1.2 {
@@ -46,7 +46,7 @@ do_eqp_test 1.3 {
SELECT * FROM f1 WHERE f1 MATCH ? ORDER BY ff
} {
QUERY PLAN
- |--SCAN TABLE f1 VIRTUAL TABLE INDEX 0:m
+ |--SCAN TABLE f1 VIRTUAL TABLE INDEX 0:M1
`--USE TEMP B-TREE FOR ORDER BY
}
diff --git a/ext/fts5/test/fts5trigram.test b/ext/fts5/test/fts5trigram.test
new file mode 100644
index 0000000000..be2c1acece
--- /dev/null
+++ b/ext/fts5/test/fts5trigram.test
@@ -0,0 +1,121 @@
+# 2020 September 30
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#*************************************************************************
+#
+# Tests for the fts5 "trigram" tokenizer.
+#
+
+source [file join [file dirname [info script]] fts5_common.tcl]
+ifcapable !fts5 { finish_test ; return }
+set ::testprefix fts5trigram
+
+do_execsql_test 1.0 {
+ CREATE VIRTUAL TABLE t1 USING fts5(y, tokenize=trigram);
+ INSERT INTO t1 VALUES('abcdefghijklm');
+ INSERT INTO t1 VALUES('กรุงเทพมหานคร');
+}
+
+foreach {tn s res} {
+ 1 abc "(abc)defghijklm"
+ 2 defgh "abc(defgh)ijklm"
+ 3 abcdefghijklm "(abcdefghijklm)"
+ 4 กรุ "(กรุ)งเทพมหานคร"
+ 5 งเทพมห "กรุ(งเทพมห)านคร"
+ 6 กรุงเทพมหานคร "(กรุงเทพมหานคร)"
+ 7 Abc "(abc)defghijklm"
+ 8 deFgh "abc(defgh)ijklm"
+ 9 aBcdefGhijKlm "(abcdefghijklm)"
+} {
+ do_execsql_test 1.1.$tn {
+ SELECT highlight(t1, 0, '(', ')') FROM t1($s)
+ } $res
+}
+
+do_execsql_test 1.2.0 {
+ SELECT fts5_expr('ABCD', 'tokenize=trigram')
+} {{"abc" + "bcd"}}
+
+do_execsql_test 1.2.1 {
+ SELECT * FROM t1 WHERE y LIKE ? ESCAPE 'a'
+}
+
+foreach {tn like res} {
+ 1 {%cDef%} 1
+ 2 {cDef%} {}
+ 3 {%f%} 1
+ 4 {%f_h%} 1
+ 5 {%f_g%} {}
+ 6 {abc%klm} 1
+ 7 {ABCDEFG%} 1
+ 8 {%รุงเ%} 2
+} {
+ do_execsql_test 1.3.$tn {
+ SELECT rowid FROM t1 WHERE y LIKE $like
+ } $res
+}
+
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 2.0 {
+ CREATE VIRTUAL TABLE t1 USING fts5(y, tokenize="trigram case_sensitive 1");
+ INSERT INTO t1 VALUES('abcdefghijklm');
+ INSERT INTO t1 VALUES('กรุงเทพมหานคร');
+}
+
+foreach {tn s res} {
+ 1 abc "(abc)defghijklm"
+ 2 defgh "abc(defgh)ijklm"
+ 3 abcdefghijklm "(abcdefghijklm)"
+ 4 กรุ "(กรุ)งเทพมหานคร"
+ 5 งเทพมห "กรุ(งเทพมห)านคร"
+ 6 กรุงเทพมหานคร "(กรุงเทพมหานคร)"
+ 7 Abc ""
+ 8 deFgh ""
+ 9 aBcdefGhijKlm ""
+} {
+ do_execsql_test 2.1.$tn {
+ SELECT highlight(t1, 0, '(', ')') FROM t1($s)
+ } $res
+}
+foreach {tn like res} {
+ 1 {%cDef%} 1
+ 2 {cDef%} {}
+ 3 {%f%} 1
+ 4 {%f_h%} 1
+ 5 {%f_g%} {}
+ 6 {abc%klm} 1
+ 7 {ABCDEFG%} 1
+ 8 {%รุงเ%} 2
+} {
+ do_execsql_test 2.2.$tn {
+ SELECT rowid FROM t1 WHERE y LIKE $like
+ } $res
+}
+foreach {tn like res} {
+ 1 {*cdef*} 1
+ 2 {cdef*} {}
+ 3 {*f*} 1
+ 4 {*f?h*} 1
+ 5 {*f?g*} {}
+ 6 {abc*klm} 1
+ 7 {abcdefg*} 1
+ 8 {*รุงเ*} 2
+ 9 {abc[d]efg*} 1
+ 10 {abc[]d]efg*} 1
+ 11 {abc[^]d]efg*} {}
+ 12 {abc[^]XYZ]efg*} 1
+} {
+ do_execsql_test 2.3.$tn {
+ SELECT rowid FROM t1 WHERE y GLOB $like
+ } $res
+}
+
+finish_test
+
diff --git a/manifest b/manifest
index c14de66d65..fded953f7e 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improved\squery\soptimization\sfor\smulti-column\sindexes\swhere\sthe\ssecond\sor\nlater\scolumns\sare\sconstrained\sby\san\sIN\soperator\sand\sthe\searlier\sindex\scolumns\nlimit\sthe\ssearch\sto\sa\ssmall\snumber\sof\srows.\s\sUse\sthe\snew\sOP_SeekScan\sopcode\nwhich\sdoes\sscanning\sof\sthe\srelevant\srange\sof\sthe\sindex\sbut\sgives\sup\sand\nfalls\sback\sto\sdoing\sa\sseek\sif\sthe\snumber\sof\srows\sscanned\sgrows\sto\slarge,\nin\sorder\sto\sguard\sagainst\spathological\scases\swhere\sthe\sestimated\snumber\nof\srows\sto\sbe\sscanned\sis\sfar\stoo\ssmall.
-D 2020-09-30T18:06:51.119
+C Add\sexperimental\sunicode-aware\strigram\stokenizer\sto\sfts5.\sAnd\ssupport\sfor\sLIKE\sand\sGLOB\soptimizations\sfor\sfts5\stables\sthat\suse\ssaid\stokenizer.
+D 2020-09-30T20:35:37.594
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -112,19 +112,19 @@ F ext/fts3/unicode/mkunicode.tcl bf7fcaa6d68e6d38223467983785d054f1cff4d9e3905dd
F ext/fts3/unicode/parseunicode.tcl a981bd6466d12dd17967515801c3ff23f74a281be1a03cf1e6f52a6959fc77eb
F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0
F ext/fts5/fts5.h c132a9323f22a972c4c93a8d5a3d901113a6e612faf30ca8e695788438c5ca2a
-F ext/fts5/fts5Int.h ba835c165bb87650fc806008969799a7a1fbe3e221fd5a850dd044eb6a87b243
+F ext/fts5/fts5Int.h 928aed51dbeb4acc0d2e3ceeebb5f6918d64c9ad5c4e7634a238895abea40350
F ext/fts5/fts5_aux.c dcc627d8b6e3fc773db528ff67b39955dab7b51628f9dba8e15849e5bedfd7fa
F ext/fts5/fts5_buffer.c 5a5fe0159752c0fb0a5a93c722e9db2662822709490769d482b76a6dc8aaca70
-F ext/fts5/fts5_config.c b447948f35ad3354e8fe5e242e0a7e7b5b941555400b9404259944e3aa570037
-F ext/fts5/fts5_expr.c b7b28ed203a3140f2fc503507d2c614a6cf1bd2e8987497f8894abc3f1477ec4
+F ext/fts5/fts5_config.c be54f44fca491e96c6923a4b9a736f2da2b13811600eb6e38d1bcc91c4ea2e61
+F ext/fts5/fts5_expr.c e1f548de5e7f146e55e1a34c2745d1893510c0766baa55d33aa05c0643398534
F ext/fts5/fts5_hash.c 15bffa734fbdca013b2289c6f8827a3b935ef14bd4dde5837d31a75434c00627
F ext/fts5/fts5_index.c 255d3ce3fec28be11c533451e5b23bd79e71a13a1b120f3658b34fff6b097816
-F ext/fts5/fts5_main.c 30969e4e14e720e9c603e66714bd1905a63defd4492d5a16d2671398a664fcfd
+F ext/fts5/fts5_main.c 65c5d579cabaecab478f4bd159ad5c040590f6a75e5afd4ad43c8b92ac65f7f2
F ext/fts5/fts5_storage.c 58ba71e6cd3d43a5735815e7956ee167babb4d2cbfe206905174792af4d09d75
F ext/fts5/fts5_tcl.c 39bcbae507f594aad778172fa914cad0f585bf92fd3b078c686e249282db0d95
F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee
F ext/fts5/fts5_test_tok.c f96c6e193c466711d6d7828d5f190407fe7ab897062d371426dd3036f01258e7
-F ext/fts5/fts5_tokenize.c 2e508c6a3bd8ee56c48e98a38052e1a650e49b32a484cce9b189984114bc3b88
+F ext/fts5/fts5_tokenize.c be911fbd2f9c9ef0db2b4b492d62628820567eb83521466250fd6df27858fb74
F ext/fts5/fts5_unicode2.c 8bd0cd07396b74c1a05590e4070d635bccfc849812c305619f109e6c0485e250
F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80
F ext/fts5/fts5_vocab.c 7a071833064dc8bca236c3c323e56aac36f583aa2c46ce916d52e31ce87462c9
@@ -198,7 +198,7 @@ F ext/fts5/test/fts5near.test 211477940142d733ac04fad97cb24095513ab2507073a99c27
F ext/fts5/test/fts5onepass.test f9b7d9b2c334900c6542a869760290e2ab5382af8fbd618834bf1fcc3e7b84da
F ext/fts5/test/fts5optimize.test 36a752d24c818792032e4ff502936fc9cc5ef938721696396fdc79214b2717f1
F ext/fts5/test/fts5phrase.test 13e5d8e9083077b3d9c74315b3c92ec723cc6eb37c8155e0bfe1bba00559f07b
-F ext/fts5/test/fts5plan.test 771b999d161e24fd803ce0290adb7c6e7c9b9cc2c6a0adb344813fb89473aa32
+F ext/fts5/test/fts5plan.test 79d35b5e83bbdcba48d946a7f008df161f6b0ede1a966892d0aa6c8dd0b6e773
F ext/fts5/test/fts5porter.test 8d08010c28527db66bc3feebd2b8767504aaeb9b101a986342fa7833d49d0d15
F ext/fts5/test/fts5porter2.test 0d251a673f02fa13ca7f011654873b3add20745f7402f108600a23e52d8c7457
F ext/fts5/test/fts5prefix.test a0fa67b06650f2deaa7bf27745899d94e0fb547ad9ecbd08bfad98c04912c056
@@ -216,6 +216,7 @@ F ext/fts5/test/fts5synonym2.test b54cce5c34ec08ed616f646635538ae82e34a0e28f947e
F ext/fts5/test/fts5tok1.test ce6551e41ff56f30b69963577324624733bed0d1753589f06120d664d9cd45c9
F ext/fts5/test/fts5tok2.test dcacb32d4a2a3f0dd3215d4a3987f78ae4be21a2
F ext/fts5/test/fts5tokenizer.test ac3c9112b263a639fb0508ae73a3ee886bf4866d2153771a8e8a20c721305a43
+F ext/fts5/test/fts5trigram.test 442b9e0c0f64838e1fad8d3d9e4ebb96f53a3033498e6e80b15d97081b320b0c
F ext/fts5/test/fts5umlaut.test a42fe2fe6387c40c49ab27ccbd070e1ae38e07f38d05926482cc0bccac9ad602
F ext/fts5/test/fts5unicode.test 17056f4efe6b0a5d4f41fdf7a7dc9af2873004562eaa899d40633b93dc95f5a9
F ext/fts5/test/fts5unicode2.test 9b3df486de05fb4bde4aa7ee8de2e6dae1df6eb90e3f2e242c9383b95d314e3e
@@ -1880,8 +1881,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 7395e96b8cc370c8ac2657fb805915b0992a15d80f8bf256d277b423fec64675 dc4172e6b8e1f62dc7329a3adb2223f290bc4c8055c265e88182ef432f4bcf10
-R 51c03f3e654933edf1a61c7fc932246b
-T +closed dc4172e6b8e1f62dc7329a3adb2223f290bc4c8055c265e88182ef432f4bcf10
-U drh
-Z bbfb93b0824db2f472432135890f2a72
+P 4a43430fd23f88352c33b29c4c105b72f6dc821f94bf362040c41a1648c402e5
+R 1f094ba3b91e26d2f277be832160094c
+T *branch * fts5-trigram
+T *sym-fts5-trigram *
+T -sym-trunk *
+U dan
+Z f75cc113cdfae84e1f09152a573517c5
diff --git a/manifest.uuid b/manifest.uuid
index 245640b3fd..8d76819c2f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-4a43430fd23f88352c33b29c4c105b72f6dc821f94bf362040c41a1648c402e5
\ No newline at end of file
+0d7810c1aea93c0a3da1ccc4911dbce8a1b6e1dbfe1ab7e800289a0c783b5985
\ No newline at end of file
From 67306cb3b4fa9019bf812d46f538044f5d354c14 Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 1 Oct 2020 14:36:15 +0000
Subject: [PATCH 090/169] The IN-early-out optimization does not work for
virtual tables. Do not try to use it there. Fix for ticket
[2d5a3163563d559f]. Test cases in TH3.
FossilOrigin-Name: dbec6910d9648f4907373c818a5cb347a2e487784208751ccecfacca752ff99d
---
manifest | 13 ++++++-------
manifest.uuid | 2 +-
src/wherecode.c | 8 +++++++-
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index c14de66d65..93c04c3143 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improved\squery\soptimization\sfor\smulti-column\sindexes\swhere\sthe\ssecond\sor\nlater\scolumns\sare\sconstrained\sby\san\sIN\soperator\sand\sthe\searlier\sindex\scolumns\nlimit\sthe\ssearch\sto\sa\ssmall\snumber\sof\srows.\s\sUse\sthe\snew\sOP_SeekScan\sopcode\nwhich\sdoes\sscanning\sof\sthe\srelevant\srange\sof\sthe\sindex\sbut\sgives\sup\sand\nfalls\sback\sto\sdoing\sa\sseek\sif\sthe\snumber\sof\srows\sscanned\sgrows\sto\slarge,\nin\sorder\sto\sguard\sagainst\spathological\scases\swhere\sthe\sestimated\snumber\nof\srows\sto\sbe\sscanned\sis\sfar\stoo\ssmall.
-D 2020-09-30T18:06:51.119
+C The\sIN-early-out\soptimization\sdoes\snot\swork\sfor\svirtual\stables.\s\sDo\nnot\stry\sto\suse\sit\sthere.\s\sFix\sfor\sticket\s[2d5a3163563d559f].\s\sTest\ncases\sin\sTH3.
+D 2020-10-01T14:36:15.462
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c da9c0d503f81cc8444eb3525b75eec2bb3d198f4d5939b207977f2fc20d85b54
F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
-F src/wherecode.c b6293c637ecfbf2f53ae4d454cc3543f671111b3018ecc30c7bc2b3007de3782
+F src/wherecode.c dd05b1c064ca8f8e8dbd2d8ba028f1d6de11f8da8ca9826435125a773a74542f
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1880,8 +1880,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 7395e96b8cc370c8ac2657fb805915b0992a15d80f8bf256d277b423fec64675 dc4172e6b8e1f62dc7329a3adb2223f290bc4c8055c265e88182ef432f4bcf10
-R 51c03f3e654933edf1a61c7fc932246b
-T +closed dc4172e6b8e1f62dc7329a3adb2223f290bc4c8055c265e88182ef432f4bcf10
+P 4a43430fd23f88352c33b29c4c105b72f6dc821f94bf362040c41a1648c402e5
+R 741e77c667ec454123453c4b44339c19
U drh
-Z bbfb93b0824db2f472432135890f2a72
+Z 211e23df85fca771cd54994f499b9652
diff --git a/manifest.uuid b/manifest.uuid
index 245640b3fd..a66f6570e8 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-4a43430fd23f88352c33b29c4c105b72f6dc821f94bf362040c41a1648c402e5
\ No newline at end of file
+dbec6910d9648f4907373c818a5cb347a2e487784208751ccecfacca752ff99d
\ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index ece0332e58..652df47cc1 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -608,7 +608,13 @@ static int codeEqualityTerm(
pIn++;
}
}
- if( iEq>0 && (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0 ){
+printf("iEq=%d wsFlags=0x%08x\n", iEq, pLoop->wsFlags); fflush(stdout);
+ testcase( iEq>0
+ && (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0
+ && (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 );
+ if( iEq>0
+ && (pLoop->wsFlags & (WHERE_IN_SEEKSCAN|WHERE_VIRTUALTABLE))==0
+ ){
sqlite3VdbeAddOp3(v, OP_SeekHit, pLevel->iIdxCur, 0, iEq);
}
}else{
From 644f43c0f77f0048d776779848457b3317f6077b Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 1 Oct 2020 14:38:39 +0000
Subject: [PATCH 091/169] Remove a debugging printf() accidentally left in the
previous check-in.
FossilOrigin-Name: e9d1efa597fb073dc4bc4286e03059a350ed05d3e6476cd3247e6cde626f458b
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/wherecode.c | 1 -
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 93c04c3143..330bf936c0 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C The\sIN-early-out\soptimization\sdoes\snot\swork\sfor\svirtual\stables.\s\sDo\nnot\stry\sto\suse\sit\sthere.\s\sFix\sfor\sticket\s[2d5a3163563d559f].\s\sTest\ncases\sin\sTH3.
-D 2020-10-01T14:36:15.462
+C Remove\sa\sdebugging\sprintf()\saccidentally\sleft\sin\sthe\sprevious\scheck-in.
+D 2020-10-01T14:38:39.049
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -624,7 +624,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c da9c0d503f81cc8444eb3525b75eec2bb3d198f4d5939b207977f2fc20d85b54
F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
-F src/wherecode.c dd05b1c064ca8f8e8dbd2d8ba028f1d6de11f8da8ca9826435125a773a74542f
+F src/wherecode.c 5fc7fe7186af2feb21bf3ff1227784bb73fea1be3690aee3cbe71a97b610e550
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1880,7 +1880,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 4a43430fd23f88352c33b29c4c105b72f6dc821f94bf362040c41a1648c402e5
-R 741e77c667ec454123453c4b44339c19
+P dbec6910d9648f4907373c818a5cb347a2e487784208751ccecfacca752ff99d
+R 9f4066930ef416a4744a7ef0d2254a3c
U drh
-Z 211e23df85fca771cd54994f499b9652
+Z 5632d0f1ff49835c03f5448669082138
diff --git a/manifest.uuid b/manifest.uuid
index a66f6570e8..53e92d2124 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-dbec6910d9648f4907373c818a5cb347a2e487784208751ccecfacca752ff99d
\ No newline at end of file
+e9d1efa597fb073dc4bc4286e03059a350ed05d3e6476cd3247e6cde626f458b
\ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index 652df47cc1..f2f2c23ded 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -608,7 +608,6 @@ static int codeEqualityTerm(
pIn++;
}
}
-printf("iEq=%d wsFlags=0x%08x\n", iEq, pLoop->wsFlags); fflush(stdout);
testcase( iEq>0
&& (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0
&& (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 );
From deaa61072dd09c153c311b7fb33b94e864b76407 Mon Sep 17 00:00:00 2001
From: drh
Date: Thu, 1 Oct 2020 15:46:21 +0000
Subject: [PATCH 092/169] Fix the OP_SeekScan opcode so that its variable names
do not cause problems for the test/vdbe-compress.tcl script.
FossilOrigin-Name: 7a78274a072324b94d6f79e5b7a198b2fa9321ff5d6a528b51f57d3ee95c765b
---
manifest | 12 ++++++------
manifest.uuid | 2 +-
src/vdbe.c | 14 +++++++-------
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/manifest b/manifest
index 330bf936c0..aee1d7da67 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sa\sdebugging\sprintf()\saccidentally\sleft\sin\sthe\sprevious\scheck-in.
-D 2020-10-01T14:38:39.049
+C Fix\sthe\sOP_SeekScan\sopcode\sso\sthat\sits\svariable\snames\sdo\snot\scause\sproblems\nfor\sthe\stest/vdbe-compress.tcl\sscript.
+D 2020-10-01T15:46:21.737
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c d3030d83fce74ba4678824a47f4d72e67dc26fd842ca64ff29a10efd1fd48551
+F src/vdbe.c 21064a2779baa2350f47ace1f5397d458588b4f4d827b238e6c06df670219f76
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -1880,7 +1880,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 dbec6910d9648f4907373c818a5cb347a2e487784208751ccecfacca752ff99d
-R 9f4066930ef416a4744a7ef0d2254a3c
+P e9d1efa597fb073dc4bc4286e03059a350ed05d3e6476cd3247e6cde626f458b
+R 50705b7b849a006d315935f49428836a
U drh
-Z 5632d0f1ff49835c03f5448669082138
+Z f6362e8d969d27a8a312e7ba48f00a9f
diff --git a/manifest.uuid b/manifest.uuid
index 53e92d2124..73933d0683 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-e9d1efa597fb073dc4bc4286e03059a350ed05d3e6476cd3247e6cde626f458b
\ No newline at end of file
+7a78274a072324b94d6f79e5b7a198b2fa9321ff5d6a528b51f57d3ee95c765b
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index 2c924abfea..2da839485a 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4433,7 +4433,7 @@ seek_not_found:
case OP_SeekScan: {
VdbeCursor *pC;
int res;
- int n;
+ int nStep;
UnpackedRecord r;
assert( pOp[1].opcode==OP_SeekGE );
@@ -4455,8 +4455,8 @@ case OP_SeekScan: {
#endif
break;
}
- n = pOp->p1;
- assert( n>=1 );
+ nStep = pOp->p1;
+ assert( nStep>=1 );
r.pKeyInfo = pC->pKeyInfo;
r.nField = (u16)pOp[1].p4.i;
r.default_rc = 0;
@@ -4478,7 +4478,7 @@ case OP_SeekScan: {
seekscan_search_fail:
#ifdef SQLITE_DEBUG
if( db->flags&SQLITE_VdbeTrace ){
- printf("... %d steps and then skip\n", pOp->p1 - n);
+ printf("... %d steps and then skip\n", pOp->p1 - nStep);
}
#endif
VdbeBranchTaken(1,3);
@@ -4488,14 +4488,14 @@ case OP_SeekScan: {
if( res==0 ){
#ifdef SQLITE_DEBUG
if( db->flags&SQLITE_VdbeTrace ){
- printf("... %d steps and then success\n", pOp->p1 - n);
+ printf("... %d steps and then success\n", pOp->p1 - nStep);
}
#endif
VdbeBranchTaken(2,3);
pOp += 2;
break;
}
- if( n<=0 ){
+ if( nStep<=0 ){
#ifdef SQLITE_DEBUG
if( db->flags&SQLITE_VdbeTrace ){
printf("... fall through after %d steps\n", pOp->p1);
@@ -4504,7 +4504,7 @@ case OP_SeekScan: {
VdbeBranchTaken(0,3);
break;
}
- n--;
+ nStep--;
rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
if( rc ){
if( rc==SQLITE_DONE ){
From ccf578d435cce596b7f7566a98b0ad8d71df1ea3 Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 1 Oct 2020 16:10:22 +0000
Subject: [PATCH 093/169] Add tests for the trigram tokenizer. Fix minor
issues.
FossilOrigin-Name: 897ced99b44085012aa44d3264940dcbd4c77b295a894a1b58fb2c03a0f7fee8
---
ext/fts5/fts5_expr.c | 8 +++++
ext/fts5/fts5_tokenize.c | 14 +++++++--
ext/fts5/test/fts5faultD.test | 2 +-
ext/fts5/test/fts5faultE.test | 53 ++++++++++++++++++++++++++++++++++
ext/fts5/test/fts5trigram.test | 13 +++++++++
manifest | 22 +++++++-------
manifest.uuid | 2 +-
7 files changed, 98 insertions(+), 16 deletions(-)
create mode 100644 ext/fts5/test/fts5faultE.test
diff --git a/ext/fts5/fts5_expr.c b/ext/fts5/fts5_expr.c
index 68d3b6e87e..21cf06208a 100644
--- a/ext/fts5/fts5_expr.c
+++ b/ext/fts5/fts5_expr.c
@@ -284,6 +284,14 @@ int sqlite3Fts5ExprNew(
return sParse.rc;
}
+/*
+** This function is only called when using the special 'trigram' tokenizer.
+** Argument zText contains the text of a LIKE or GLOB pattern matched
+** against column iCol. This function creates and compiles an FTS5 MATCH
+** expression that will match a superset of the rows matched by the LIKE or
+** GLOB. If successful, SQLITE_OK is returned. Otherwise, an SQLite error
+** code.
+*/
int sqlite3Fts5ExprPattern(
Fts5Config *pConfig, int iCol, const char *zText, Fts5Expr **pp
){
diff --git a/ext/fts5/fts5_tokenize.c b/ext/fts5/fts5_tokenize.c
index b3c3995504..665c613306 100644
--- a/ext/fts5/fts5_tokenize.c
+++ b/ext/fts5/fts5_tokenize.c
@@ -1261,10 +1261,9 @@ static int fts5PorterTokenize(
/**************************************************************************
** Start of trigram implementation.
*/
-
typedef struct TrigramTokenizer TrigramTokenizer;
struct TrigramTokenizer {
- int bFold;
+ int bFold; /* True to fold to lower-case */
};
/*
@@ -1359,6 +1358,17 @@ static int fts5TriTokenize(
return rc;
}
+/*
+** Argument xCreate is a pointer to a constructor function for a tokenizer.
+** pTok is a tokenizer previously created using the same method. This function
+** returns one of FTS5_PATTERN_NONE, FTS5_PATTERN_LIKE or FTS5_PATTERN_GLOB
+** indicating the style of pattern matching that the tokenizer can support.
+** In practice, this is:
+**
+** "trigram" tokenizer, case_sensitive=1 - FTS5_PATTERN_GLOB
+** "trigram" tokenizer, case_sensitive=0 (the default) - FTS5_PATTERN_LIKE
+** all other tokenizers - FTS5_PATTERN_NONE
+*/
int sqlite3Fts5TokenizerPattern(
int (*xCreate)(void*, const char**, int, Fts5Tokenizer**),
Fts5Tokenizer *pTok
diff --git a/ext/fts5/test/fts5faultD.test b/ext/fts5/test/fts5faultD.test
index e259cbf610..33590645ce 100644
--- a/ext/fts5/test/fts5faultD.test
+++ b/ext/fts5/test/fts5faultD.test
@@ -14,7 +14,7 @@
source [file join [file dirname [info script]] fts5_common.tcl]
source $testdir/malloc_common.tcl
-set testprefix fts5faultA
+set testprefix fts5faultD
# If SQLITE_ENABLE_FTS3 is defined, omit this file.
ifcapable !fts5 {
diff --git a/ext/fts5/test/fts5faultE.test b/ext/fts5/test/fts5faultE.test
new file mode 100644
index 0000000000..1ab3479901
--- /dev/null
+++ b/ext/fts5/test/fts5faultE.test
@@ -0,0 +1,53 @@
+# 2016 February 2
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#*************************************************************************
+#
+# This file is focused on OOM errors.
+#
+
+source [file join [file dirname [info script]] fts5_common.tcl]
+source $testdir/malloc_common.tcl
+set testprefix fts5faultE
+
+# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
+ifcapable !fts5 {
+ finish_test
+ return
+}
+
+faultsim_save_and_close
+do_faultsim_test 1 -prep {
+ faultsim_restore_and_reopen
+} -body {
+ execsql { CREATE VIRTUAL TABLE t1 USING fts5(x, y, tokenize=trigram) }
+} -test {
+ faultsim_test_result {0 {}} {1 {vtable constructor failed: t1}}
+}
+
+reset_db
+do_execsql_test 2.0 {
+ CREATE VIRTUAL TABLE t1 USING fts5(x, y, tokenize=trigram);
+}
+
+faultsim_save_and_close
+do_faultsim_test 2 -faults ioerr-t* -prep {
+ faultsim_restore_and_reopen
+} -body {
+ execsql {
+ INSERT INTO t1 VALUES('abcdefghijklmnopqrstuvwxyz', NULL);
+ SELECT count(*) FROM t1 WHERE x LIKE '%mnop%' AND t1 MATCH 'jkl';
+ }
+} -test {
+ faultsim_test_result {0 1} {1 {vtable constructor failed: t1}}
+}
+
+
+finish_test
+
diff --git a/ext/fts5/test/fts5trigram.test b/ext/fts5/test/fts5trigram.test
index be2c1acece..ebdc8d30ce 100644
--- a/ext/fts5/test/fts5trigram.test
+++ b/ext/fts5/test/fts5trigram.test
@@ -117,5 +117,18 @@ foreach {tn like res} {
} $res
}
+#-------------------------------------------------------------------------
+reset_db
+do_catchsql_test 3.1 {
+ CREATE VIRTUAL TABLE ttt USING fts5(c, tokenize="trigram case_sensitive 2");
+} {1 {error in tokenizer constructor}}
+do_catchsql_test 3.2 {
+ CREATE VIRTUAL TABLE ttt USING fts5(c, tokenize="trigram case_sensitive 11");
+} {1 {error in tokenizer constructor}}
+do_catchsql_test 3.3 {
+ CREATE VIRTUAL TABLE ttt USING fts5(c, "tokenize=trigram case_sensitive 1");
+} {0 {}}
+
+
finish_test
diff --git a/manifest b/manifest
index fded953f7e..70f72c9d32 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sexperimental\sunicode-aware\strigram\stokenizer\sto\sfts5.\sAnd\ssupport\sfor\sLIKE\sand\sGLOB\soptimizations\sfor\sfts5\stables\sthat\suse\ssaid\stokenizer.
-D 2020-09-30T20:35:37.594
+C Add\stests\sfor\sthe\strigram\stokenizer.\sFix\sminor\sissues.
+D 2020-10-01T16:10:22.243
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -116,7 +116,7 @@ F ext/fts5/fts5Int.h 928aed51dbeb4acc0d2e3ceeebb5f6918d64c9ad5c4e7634a238895abea
F ext/fts5/fts5_aux.c dcc627d8b6e3fc773db528ff67b39955dab7b51628f9dba8e15849e5bedfd7fa
F ext/fts5/fts5_buffer.c 5a5fe0159752c0fb0a5a93c722e9db2662822709490769d482b76a6dc8aaca70
F ext/fts5/fts5_config.c be54f44fca491e96c6923a4b9a736f2da2b13811600eb6e38d1bcc91c4ea2e61
-F ext/fts5/fts5_expr.c e1f548de5e7f146e55e1a34c2745d1893510c0766baa55d33aa05c0643398534
+F ext/fts5/fts5_expr.c 7eba8fed2a8f154413814f63c21b34d7562b7d80a62614b9301a5ba6a700f4f0
F ext/fts5/fts5_hash.c 15bffa734fbdca013b2289c6f8827a3b935ef14bd4dde5837d31a75434c00627
F ext/fts5/fts5_index.c 255d3ce3fec28be11c533451e5b23bd79e71a13a1b120f3658b34fff6b097816
F ext/fts5/fts5_main.c 65c5d579cabaecab478f4bd159ad5c040590f6a75e5afd4ad43c8b92ac65f7f2
@@ -124,7 +124,7 @@ F ext/fts5/fts5_storage.c 58ba71e6cd3d43a5735815e7956ee167babb4d2cbfe20690517479
F ext/fts5/fts5_tcl.c 39bcbae507f594aad778172fa914cad0f585bf92fd3b078c686e249282db0d95
F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee
F ext/fts5/fts5_test_tok.c f96c6e193c466711d6d7828d5f190407fe7ab897062d371426dd3036f01258e7
-F ext/fts5/fts5_tokenize.c be911fbd2f9c9ef0db2b4b492d62628820567eb83521466250fd6df27858fb74
+F ext/fts5/fts5_tokenize.c 5711f170065d23809afa97475c4adcd03387da043feb2fb2a1660fe366c01647
F ext/fts5/fts5_unicode2.c 8bd0cd07396b74c1a05590e4070d635bccfc849812c305619f109e6c0485e250
F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80
F ext/fts5/fts5_vocab.c 7a071833064dc8bca236c3c323e56aac36f583aa2c46ce916d52e31ce87462c9
@@ -179,7 +179,8 @@ F ext/fts5/test/fts5fault8.test 318238659d35f82ad215ecb57ca4c87486ea85d45dbeedae
F ext/fts5/test/fts5fault9.test 098e6b894bbdf9b2192f994a30f4043673fb3f338b6b8ab1624c704422f39119
F ext/fts5/test/fts5faultA.test be4487576bff8c22cee6597d1893b312f306504a8c6ccd3c53ca85af12290c8c
F ext/fts5/test/fts5faultB.test d606bdb8e81aaeb6f41de3fc9fc7ae315733f0903fbff05cf54f5b045b729ab5
-F ext/fts5/test/fts5faultD.test cc5d1225556e356615e719c612e845d41bff7d5a
+F ext/fts5/test/fts5faultD.test e7ed7895abfe6bc98a5e853826f6b74956e7ba7f594f1860bbf9e504b9647996
+F ext/fts5/test/fts5faultE.test aa7caab3597390b753e0755c087f118f775804a070bd0960f5a4bb6246ed6a29
F ext/fts5/test/fts5first.test 3fcf2365c00a15fc9704233674789a3b95131d12de18a9b996159f6909dc8079
F ext/fts5/test/fts5full.test e1701a112354e0ff9a1fdffb0c940c576530c33732ee20ac5e8361777070d717
F ext/fts5/test/fts5fuzz1.test 238d8c45f3b81342aa384de3e581ff2fa330bf922a7b69e484bbc06051a1080e
@@ -216,7 +217,7 @@ F ext/fts5/test/fts5synonym2.test b54cce5c34ec08ed616f646635538ae82e34a0e28f947e
F ext/fts5/test/fts5tok1.test ce6551e41ff56f30b69963577324624733bed0d1753589f06120d664d9cd45c9
F ext/fts5/test/fts5tok2.test dcacb32d4a2a3f0dd3215d4a3987f78ae4be21a2
F ext/fts5/test/fts5tokenizer.test ac3c9112b263a639fb0508ae73a3ee886bf4866d2153771a8e8a20c721305a43
-F ext/fts5/test/fts5trigram.test 442b9e0c0f64838e1fad8d3d9e4ebb96f53a3033498e6e80b15d97081b320b0c
+F ext/fts5/test/fts5trigram.test 0a9ade9e808c388d13e9ea925a1bf42f3fa873a90dcd5969ef6e50bdd9483873
F ext/fts5/test/fts5umlaut.test a42fe2fe6387c40c49ab27ccbd070e1ae38e07f38d05926482cc0bccac9ad602
F ext/fts5/test/fts5unicode.test 17056f4efe6b0a5d4f41fdf7a7dc9af2873004562eaa899d40633b93dc95f5a9
F ext/fts5/test/fts5unicode2.test 9b3df486de05fb4bde4aa7ee8de2e6dae1df6eb90e3f2e242c9383b95d314e3e
@@ -1881,10 +1882,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 4a43430fd23f88352c33b29c4c105b72f6dc821f94bf362040c41a1648c402e5
-R 1f094ba3b91e26d2f277be832160094c
-T *branch * fts5-trigram
-T *sym-fts5-trigram *
-T -sym-trunk *
+P 0d7810c1aea93c0a3da1ccc4911dbce8a1b6e1dbfe1ab7e800289a0c783b5985
+R c7737548b4b859bb94163b777bb03b06
U dan
-Z f75cc113cdfae84e1f09152a573517c5
+Z afc946f18e97090d1c0b09338fc98cec
diff --git a/manifest.uuid b/manifest.uuid
index 8d76819c2f..b9e8dd8af3 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-0d7810c1aea93c0a3da1ccc4911dbce8a1b6e1dbfe1ab7e800289a0c783b5985
\ No newline at end of file
+897ced99b44085012aa44d3264940dcbd4c77b295a894a1b58fb2c03a0f7fee8
\ No newline at end of file
From a22c1c84ccd3bec06dc24c37aab94c870a5a4817 Mon Sep 17 00:00:00 2001
From: dan
Date: Thu, 1 Oct 2020 17:15:12 +0000
Subject: [PATCH 094/169] Add the -trigram option to the fts5txt2db.tcl script.
FossilOrigin-Name: a394dd260252e7b7dcbc90fd321dfd40d9375f0598ea52b01001c568cbdbafce
---
ext/fts5/tool/fts5txt2db.tcl | 2 ++
manifest | 12 ++++++------
manifest.uuid | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/ext/fts5/tool/fts5txt2db.tcl b/ext/fts5/tool/fts5txt2db.tcl
index 4766b00b06..1996b2c313 100644
--- a/ext/fts5/tool/fts5txt2db.tcl
+++ b/ext/fts5/tool/fts5txt2db.tcl
@@ -12,6 +12,7 @@ proc process_cmdline {} {
cmdline::process ::A $::argv {
{fts5 "use fts5 (this is the default)"}
{fts4 "use fts4"}
+ {trigram "Use tokenize=trigram"}
{colsize "10 10 10" "list of column sizes"}
{tblname "t1" "table name to create"}
{detail "full" "Fts5 detail mode to use"}
@@ -175,6 +176,7 @@ proc create_table {} {
set sql "CREATE VIRTUAL TABLE IF NOT EXISTS $A(tblname) USING $A(fts) ("
append sql [join $cols ,]
if {$A(fts)=="fts5"} { append sql ",detail=$A(detail)" }
+ if {$A(trigram)} { append sql ",tokenize=trigram" }
append sql ", prefix='$A(prefix)');"
db eval $sql
diff --git a/manifest b/manifest
index 70f72c9d32..c82a299684 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\stests\sfor\sthe\strigram\stokenizer.\sFix\sminor\sissues.
-D 2020-10-01T16:10:22.243
+C Add\sthe\s-trigram\soption\sto\sthe\sfts5txt2db.tcl\sscript.
+D 2020-10-01T17:15:12.635
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -229,7 +229,7 @@ F ext/fts5/test/fts5version.test c8f2cc105f0abf0224965f93e584633dee3e06c91478bc6
F ext/fts5/test/fts5vocab.test 7ed80d9af1ddaaa1637da05e406327b5aac250848bc604c1c1cc667908b87760
F ext/fts5/test/fts5vocab2.test e0fdc3a3095f6eda68ac9bf9a443ff929a124d46f00af19933604085712e9d47
F ext/fts5/tool/fts5speed.tcl b0056f91a55b2d1a3684ec05729de92b042e2f85
-F ext/fts5/tool/fts5txt2db.tcl 526a9979c963f1c54fd50976a05a502e533a4c59
+F ext/fts5/tool/fts5txt2db.tcl c0d43c8590656f8240e622b00957b3a0facc49482411a9fdc2870b45c0c82f9f
F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093
F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45
F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
@@ -1882,7 +1882,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 0d7810c1aea93c0a3da1ccc4911dbce8a1b6e1dbfe1ab7e800289a0c783b5985
-R c7737548b4b859bb94163b777bb03b06
+P 897ced99b44085012aa44d3264940dcbd4c77b295a894a1b58fb2c03a0f7fee8
+R f0ac7902a5171a39eaf194e52bef0a98
U dan
-Z afc946f18e97090d1c0b09338fc98cec
+Z 2da13f86d1d686cfa74ee427cae5fd66
diff --git a/manifest.uuid b/manifest.uuid
index b9e8dd8af3..6e00578a5c 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-897ced99b44085012aa44d3264940dcbd4c77b295a894a1b58fb2c03a0f7fee8
\ No newline at end of file
+a394dd260252e7b7dcbc90fd321dfd40d9375f0598ea52b01001c568cbdbafce
\ No newline at end of file
From 4ad1a1c74caeee76124091e6e1771fae4afa1a33 Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 2 Oct 2020 02:02:18 +0000
Subject: [PATCH 095/169] Disable the OP_SeekScan opcode of the
in-scan-vs-index optimization when in PRAGMA reverse_unordered_selects mode,
as the OP_SeekScan only works with forwards scans. Thanks to OSSFuzz for
pointing out the problem to us.
FossilOrigin-Name: c75c3a3b756635bfdab44e4b56a337e4a88af3a8803cd3e9a67abf3d0d3450dc
---
manifest | 17 ++++++++---------
manifest.uuid | 2 +-
src/wherecode.c | 8 ++++++--
test/whereA.test | 15 +++++++++++++++
4 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/manifest b/manifest
index acf1e33d84..0eea4bd383 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sexperimental\s"trigram"\stokenizer\sto\sfts5.
-D 2020-10-01T17:24:36.768
+C Disable\sthe\sOP_SeekScan\sopcode\sof\sthe\sin-scan-vs-index\soptimization\swhen\nin\sPRAGMA\sreverse_unordered_selects\smode,\sas\sthe\sOP_SeekScan\sonly\sworks\nwith\sforwards\sscans.\s\sThanks\sto\sOSSFuzz\sfor\spointing\sout\sthe\sproblem\sto\nus.
+D 2020-10-02T02:02:18.404
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -626,7 +626,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c da9c0d503f81cc8444eb3525b75eec2bb3d198f4d5939b207977f2fc20d85b54
F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
-F src/wherecode.c 5fc7fe7186af2feb21bf3ff1227784bb73fea1be3690aee3cbe71a97b610e550
+F src/wherecode.c d19490e96a2829324813ac244e20d76864a463ae0c7d2dc89cb1a5aef858d416
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1722,7 +1722,7 @@ F test/where6.test 5da5a98cec820d488e82708301b96cb8c18a258b
F test/where7.test 75722434c486ac9e74718caa6cce234f45ba34c0b6c0f9555b29eb8bb5f6ade1
F test/where8.test 461ca40265ed996a6305da99bb024b0e41602bb586acf544c08f95922358e49f
F test/where9.test 8e3e0ff42cc17156f52361a1c012281550d0d632912fec92d1d6df74db7a8e6d
-F test/whereA.test 6c6a420ca7d313242f9b1bd471dc80e4d0f8323700ba9c78df0bb843d4daa3b4
+F test/whereA.test 9d1077b117f1b68d5f739d94f36956c36cf995eb87bb19b77b2e81af020edd20
F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5
F test/whereC.test cae295158703cb3fc23bf1a108a9ab730efff0f6
F test/whereD.test c1c335e914e28b122e000e9310f02d2be83e1c9dbca2e29f46bd732703944d1b
@@ -1882,8 +1882,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 7a78274a072324b94d6f79e5b7a198b2fa9321ff5d6a528b51f57d3ee95c765b a394dd260252e7b7dcbc90fd321dfd40d9375f0598ea52b01001c568cbdbafce
-R 104c9174ee4e67de5600298bebaefb92
-T +closed a394dd260252e7b7dcbc90fd321dfd40d9375f0598ea52b01001c568cbdbafce
-U dan
-Z 65fad92c1f5f48b452b431c90b403063
+P c4e8ec7907de7cb9e610ef9f4930caf5c046618151fb4f61d5716b9fa3f31423
+R fa30a71b336d683cc8024e641011870d
+U drh
+Z 915215785688876043fcc94bb57ffcd9
diff --git a/manifest.uuid b/manifest.uuid
index 7a27efdb1d..cd98fc97c8 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-c4e8ec7907de7cb9e610ef9f4930caf5c046618151fb4f61d5716b9fa3f31423
\ No newline at end of file
+c75c3a3b756635bfdab44e4b56a337e4a88af3a8803cd3e9a67abf3d0d3450dc
\ No newline at end of file
diff --git a/src/wherecode.c b/src/wherecode.c
index f2f2c23ded..21f644d07d 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1808,8 +1808,12 @@ Bitmask sqlite3WhereCodeOneLoopStart(
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
assert( op!=0 );
- if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 ){
- assert( op==OP_SeekGE );
+ assert( op==OP_SeekGE
+ || (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0
+ || (db->flags & SQLITE_ReverseOrder)!=0 );
+ if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0
+ && op==OP_SeekGE /* OP_SeekScan only does forward scans */
+ ){
assert( regBignull==0 );
/* TUNING: The OP_SeekScan opcode seeks to reduce the number
** of expensive seek operations by replacing a single seek with
diff --git a/test/whereA.test b/test/whereA.test
index 478ef5c324..dff24d8c83 100644
--- a/test/whereA.test
+++ b/test/whereA.test
@@ -170,5 +170,20 @@ do_execsql_test whereA-5.1 {
SELECT a FROM t1 WHERE b=-99 OR b>1;
} {1}
+# 2020-10-02 OSSFuzz find for an issue introduced by a check-in
+# on the previous day.
+#
+reset_db
+do_execsql_test whereA-6.1 {
+ CREATE TABLE t1(a, b);
+ CREATE INDEX t1aa ON t1(a,a);
+ INSERT INTO t1 VALUES(1,2);
+ ANALYZE;
+ UPDATE sqlite_stat1 SET stat='27 3 3' WHERE idx='t1aa';
+ ANALYZE sqlite_schema;
+ PRAGMA reverse_unordered_selects (1) ;
+ SELECT a FROM t1 WHERE a=1 OR a=2;
+} {1}
+
finish_test
From 04e70ce07d8a9501c695eaafd2cb4dfc4537761f Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 2 Oct 2020 11:55:07 +0000
Subject: [PATCH 096/169] For the OP_SeekScan optimization, the OP_IdxGT does
not necessarily come right after the OP_SeekGE. So use the P2 operand of
OP_SeekScan to point to the first instruction after OP_IdxGT. Problem found
by dbsqlfuzz.
FossilOrigin-Name: 091d71939411bf2079098f09ddc0525f11f380119fd27114e2b3eec9a8ac0db4
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/vdbe.c | 31 ++++++++++++++++++-------------
src/wherecode.c | 5 ++++-
4 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/manifest b/manifest
index 0eea4bd383..8fcb59af13 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Disable\sthe\sOP_SeekScan\sopcode\sof\sthe\sin-scan-vs-index\soptimization\swhen\nin\sPRAGMA\sreverse_unordered_selects\smode,\sas\sthe\sOP_SeekScan\sonly\sworks\nwith\sforwards\sscans.\s\sThanks\sto\sOSSFuzz\sfor\spointing\sout\sthe\sproblem\sto\nus.
-D 2020-10-02T02:02:18.404
+C For\sthe\sOP_SeekScan\soptimization,\sthe\sOP_IdxGT\sdoes\snot\snecessarily\scome\nright\safter\sthe\sOP_SeekGE.\s\s\sSo\suse\sthe\sP2\soperand\sof\sOP_SeekScan\sto\spoint\nto\sthe\sfirst\sinstruction\safter\sOP_IdxGT.\s\sProblem\sfound\sby\sdbsqlfuzz.
+D 2020-10-02T11:55:07.348
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -609,7 +609,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002
F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286
-F src/vdbe.c 21064a2779baa2350f47ace1f5397d458588b4f4d827b238e6c06df670219f76
+F src/vdbe.c 4bfad8953765d4a10237fa939b18af69edb3a24dcf2a0392dcd00b04e0eede6a
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e
F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9
@@ -626,7 +626,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c 3df26a33dc4f54e8771600fb7fdebe1ece0896c2ad68c30ab40b017aa4395049
F src/where.c da9c0d503f81cc8444eb3525b75eec2bb3d198f4d5939b207977f2fc20d85b54
F src/whereInt.h 59077fbd0b3d01bc8715e746c86a99ebf4c85bde8a57077ec04d2a23e59666ec
-F src/wherecode.c d19490e96a2829324813ac244e20d76864a463ae0c7d2dc89cb1a5aef858d416
+F src/wherecode.c 1a229b9d1f7dd306ee3e82e629caaf424f7ba2f67b045f944c0b0a064ea3c59f
F src/whereexpr.c 2a05552e808047a93845278c98c6ca64a265fa8e9ffd087c161bb11bfe339866
F src/window.c edd6f5e25a1e8f2b6f5305b7f5f7da7bb35f07f0d432b255b1d4c2fcab4205aa
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
@@ -1882,7 +1882,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 c4e8ec7907de7cb9e610ef9f4930caf5c046618151fb4f61d5716b9fa3f31423
-R fa30a71b336d683cc8024e641011870d
+P c75c3a3b756635bfdab44e4b56a337e4a88af3a8803cd3e9a67abf3d0d3450dc
+R 77a10f931fe8a41cf53227c081acbc3f
U drh
-Z 915215785688876043fcc94bb57ffcd9
+Z d91a0ab90aafbccf74379e7aee46aee8
diff --git a/manifest.uuid b/manifest.uuid
index cd98fc97c8..cefaca244f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-c75c3a3b756635bfdab44e4b56a337e4a88af3a8803cd3e9a67abf3d0d3450dc
\ No newline at end of file
+091d71939411bf2079098f09ddc0525f11f380119fd27114e2b3eec9a8ac0db4
\ No newline at end of file
diff --git a/src/vdbe.c b/src/vdbe.c
index 2da839485a..a7691c39fd 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4384,18 +4384,18 @@ seek_not_found:
}
-/* Opcode: SeekScan P1 * * * *
+/* Opcode: SeekScan P1 P2 * * *
** Synopsis: Scan-ahead up to P1 rows
**
** This opcode is a prefix opcode to OP_SeekGE. In other words, this
-** opcode must be immediately followed by OP_SeekGE. Furthermore, the
-** OP_SeekGE must be followed by OP_IdxGT. These constraints are
+** opcode must be immediately followed by OP_SeekGE. This constraint is
** checked by assert() statements.
**
** This opcode uses the P1 through P4 operands of the subsequent
** OP_SeekGE. In the text that follows, the operands of the subsequent
** OP_SeekGE opcode are denoted as SeekOP.P1 through SeekOP.P4. Only
-** the P1 operand of this opcode is used, and it is denoted as This.P1.
+** the P1 and P2 operands of this opcode are also used, and are called
+** This.P1 and This.P2.
**
** This opcode helps to optimize IN operators on a multi-column index
** where the IN operator is on the later terms of the index by avoiding
@@ -4413,7 +4413,7 @@ seek_not_found:
** If the SeekGE.P1 cursor is pointing to a valid row, then that row
** might be the target row, or it might be near and slightly before the
** target row. This opcode attempts to position the cursor on the target
-** row by, perhaps stepping by invoking sqlite3BtreeStep() on the cursor
+** row by, perhaps by invoking sqlite3BtreeStep() on the cursor
** between 0 and This.P1 times.
**
** There are three possible outcomes from this opcode:
@@ -4423,8 +4423,8 @@ seek_not_found:
** then fall through into the subsquence OP_SeekGE opcode.
**
** - If the cursor is successfully moved to the target row by 0 or more
-** sqlite3BtreeNext() calls, then jump to the first instruction after the
-** OP_IdxGT opcode - or in other words, skip the next two opcodes.
+** sqlite3BtreeNext() calls, then jump to This.P2, which will land just
+** past the OP_IdxGT opcode that follows the OP_SeekGE.
**
**
- If the cursor ends up past the target row (indicating the the target
** row does not exist in the btree) then jump to SeekOP.P2.
@@ -4437,11 +4437,16 @@ case OP_SeekScan: {
UnpackedRecord r;
assert( pOp[1].opcode==OP_SeekGE );
- assert( pOp[2].opcode==OP_IdxGT );
- assert( pOp[1].p1==pOp[2].p1 );
- assert( pOp[1].p2==pOp[2].p2 );
- assert( pOp[1].p3==pOp[2].p3 );
- assert( pOp[1].p4.i==pOp[2].p4.i );
+
+ /* pOp->p2 points to the first instruction past the OP_IdxGT that
+ ** follows the OP_SeekGE. */
+ assert( pOp->p2>=(int)(pOp-aOp)+2 );
+ assert( aOp[pOp->p2-1].opcode==OP_IdxGT );
+ assert( pOp[1].p1==aOp[pOp->p2-1].p1 );
+ assert( pOp[1].p2==aOp[pOp->p2-1].p2 );
+ assert( pOp[1].p3==aOp[pOp->p2-1].p3 );
+ assert( pOp[1].p4.i==aOp[pOp->p2-1].p4.i );
+
assert( pOp->p1>0 );
pC = p->apCsr[pOp[1].p1];
assert( pC!=0 );
@@ -4492,7 +4497,7 @@ case OP_SeekScan: {
}
#endif
VdbeBranchTaken(2,3);
- pOp += 2;
+ goto jump_to_p2;
break;
}
if( nStep<=0 ){
diff --git a/src/wherecode.c b/src/wherecode.c
index 21f644d07d..3fe67e384d 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1663,6 +1663,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
u8 bStopAtNull = 0; /* Add condition to terminate at NULLs */
int omitTable; /* True if we use the index only */
int regBignull = 0; /* big-null flag register */
+ int addrSeekScan = 0; /* Opcode of the OP_SeekScan, if any */
pIdx = pLoop->u.btree.pIndex;
iIdxCur = pLevel->iIdxCur;
@@ -1823,7 +1824,8 @@ Bitmask sqlite3WhereCodeOneLoopStart(
** of entries in the tree, so basing the number of steps to try
** on the estimated number of rows in the btree seems like a good
** guess. */
- sqlite3VdbeAddOp1(v, OP_SeekScan, (pIdx->aiRowLogEst[0]+9)/10);
+ addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
+ (pIdx->aiRowLogEst[0]+9)/10);
VdbeCoverage(v);
}
sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
@@ -1908,6 +1910,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
testcase( op==OP_IdxGE ); VdbeCoverageIf(v, op==OP_IdxGE );
testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT );
testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE );
+ if( addrSeekScan ) sqlite3VdbeJumpHere(v, addrSeekScan);
}
if( regBignull ){
/* During a NULL-scan, check to see if we have reached the end of
From 9bb612f2c8d0e1e9672aa019b0f05059b6c24c3a Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 2 Oct 2020 12:42:51 +0000
Subject: [PATCH 097/169] Fix a faulty assert() statement. Add new test cases.
FossilOrigin-Name: 80ecdb3da4558bb08ee3ec6edbde906ad5b3b8182e672b5ba0d5dfa8041cee0a
---
manifest | 16 ++++++++--------
manifest.uuid | 2 +-
src/expr.c | 4 +++-
test/fuzzdata8.db | Bin 1602560 -> 1616896 bytes
test/select1.test | 9 +++++++++
5 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/manifest b/manifest
index 8fcb59af13..ed943c4e83 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C For\sthe\sOP_SeekScan\soptimization,\sthe\sOP_IdxGT\sdoes\snot\snecessarily\scome\nright\safter\sthe\sOP_SeekGE.\s\s\sSo\suse\sthe\sP2\soperand\sof\sOP_SeekScan\sto\spoint\nto\sthe\sfirst\sinstruction\safter\sOP_IdxGT.\s\sProblem\sfound\sby\sdbsqlfuzz.
-D 2020-10-02T11:55:07.348
+C Fix\sa\sfaulty\sassert()\sstatement.\s\sAdd\snew\stest\scases.
+D 2020-10-02T12:42:51.317
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -489,7 +489,7 @@ F src/date.c dace306a10d9b02ee553d454c8e1cf8d3c9b932e137738a6b15b90253a9bfc10
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
F src/delete.c a2a603ab07cced8560065b0e2c4c9c842f2c5a2fd43d87355f95eb53bae7fe21
-F src/expr.c 4c8b9c2942adb896b9d1613794bd00cbf98c94e38c41cd5720b78bcdc21a965d
+F src/expr.c 2cfe739c81e9751123b900dee54f6d34f8ec4b747515a51f1771de8e2840650d
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 83372403298e6a7dd989a47aaacdbaa5b4307b5199dbd56e07d4896066b3de72
F src/func.c 2333eb4277f55a5efdc12ef754e7d7ec9105d257b2fd00301d23ce1e8fa67dc0
@@ -1037,7 +1037,7 @@ F test/fuzzdata4.db b502c7d5498261715812dd8b3c2005bad08b3a26e6489414bd13926cd3e4
F test/fuzzdata5.db e35f64af17ec48926481cfaf3b3855e436bd40d1cfe2d59a9474cb4b748a52a5
F test/fuzzdata6.db 92a80e4afc172c24f662a10a612d188fb272de4a9bd19e017927c95f737de6d7
F test/fuzzdata7.db 0166b56fd7a6b9636a1d60ef0a060f86ddaecf99400a666bb6e5bbd7199ad1f2
-F test/fuzzdata8.db 99f99201280962430f3287e879e050ba88fe458d05cbf28e37ecab369ffe2e86
+F test/fuzzdata8.db f8451a1fd38efbea8c1a7cdf5d02259c4702446a9fabf566becd306b64a50236
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test 8792cd77fd5bce765b05d0c8e01b9edcf8af8536
@@ -1314,7 +1314,7 @@ F test/schema6.test e4bd1f23d368695eb9e7b51ef6e02ca0642ea2ab4a52579959826b5e7dce
F test/schemafault.test 1936bceca55ac82c5efbcc9fc91a1933e45c8d1e1d106b9a7e56c972a5a2a51e
F test/securedel.test 2f70b2449186a1921bd01ec9da407fbfa98c3a7a5521854c300c194b2ff09384
F test/securedel2.test 2d54c28e46eb1fd6902089958b20b1b056c6f1c5
-F test/select1.test 009a6d8eacd9684d046302b8d13b50846a87e39d6f08e92178aa13e95ea29a2d
+F test/select1.test 0ed936740777f52858b6607f39ffac4b2b63b8fc7edf3ab2ebad3c3553ceecee
F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56
F test/select3.test c49fbb758903f3718e2de5aa4655eda4838131cbea24a86db908f8b6889aa68c
F test/select4.test e8a2502e3623f3058871030599a48abb35789d2244d5b380ecf3696873fdd4a4
@@ -1882,7 +1882,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 c75c3a3b756635bfdab44e4b56a337e4a88af3a8803cd3e9a67abf3d0d3450dc
-R 77a10f931fe8a41cf53227c081acbc3f
+P 091d71939411bf2079098f09ddc0525f11f380119fd27114e2b3eec9a8ac0db4
+R ab2660b8b3dcfc34d3f30bc4d246a05d
U drh
-Z d91a0ab90aafbccf74379e7aee46aee8
+Z a26077e1b2dfaf7c2f33f5727d3e0262
diff --git a/manifest.uuid b/manifest.uuid
index cefaca244f..23a0b8446c 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-091d71939411bf2079098f09ddc0525f11f380119fd27114e2b3eec9a8ac0db4
\ No newline at end of file
+80ecdb3da4558bb08ee3ec6edbde906ad5b3b8182e672b5ba0d5dfa8041cee0a
\ No newline at end of file
diff --git a/src/expr.c b/src/expr.c
index 7277bb75de..2c4d233311 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -45,7 +45,9 @@ char sqlite3TableColumnAffinity(Table *pTab, int iCol){
char sqlite3ExprAffinity(const Expr *pExpr){
int op;
while( ExprHasProperty(pExpr, EP_Skip|EP_IfNullRow) ){
- assert( pExpr->op==TK_COLLATE || pExpr->op==TK_IF_NULL_ROW );
+ assert( pExpr->op==TK_COLLATE
+ || pExpr->op==TK_IF_NULL_ROW
+ || (pExpr->op==TK_REGISTER && pExpr->op2==TK_IF_NULL_ROW) );
pExpr = pExpr->pLeft;
assert( pExpr!=0 );
}
diff --git a/test/fuzzdata8.db b/test/fuzzdata8.db
index 2408696440a54ad9f95e1788afaf5804ef931832..39191fc8b1f03935f6b661eab5af1e2e2fba7285 100644
GIT binary patch
delta 38282
zcmeFa2Ut|s)-XK#lsRYm8AQR#U@s^$bgZCaFQC{PMTr^}Fm|JGu*4)52!@qnfoL>|
zMzOKfSRmCT7DzRTQH-XTYg9~+M*p=3#FE_mzW4s`_x<1hJfC@H4RgxgYp=ET+Iz2-
z?C+AZPp9NIbXp7sV>`p$f1~q)LS>7gL;u`e6Spd?SH4w!8AkcrreqlmVw9dhu#Fy1
zu&F+PU>&_bL0Ru>FbIF@y$SxL_agX%9!IcJ?@6#+?@sW2J(l1xJ%-?0dN+bc^{xa_
z?@Vxy-ihEVdNjco^eBQG^+9O$L3m0JqaRP|p#)dx9)insH^BvZFu~b6
zjYF8Bw;?!DZ$&U!Z$WUl-kjhNy(z)|dLY3#J%C_$y$QjtdSil-dLx3NdIN&NxAI^g0GZmQY{!p&v%wX)v%~bSuHjx|!g|x{2V2xfsK<1tV<*C>_h_3BooL_BCuvWf#u@}EFME(;wS>6M-mt@
zjKI*L1O^Tv(3@DxVu`b?(_jMOg9robFvxC%6C3=@mawq!km!(5cW8tg*imCW76C=K
zS;J6sWK@JZGAuMCJT272zujTfH2w2LRe!tPp;2y+JHiv`p?_{qcq%ymF#1FGX1_2N
z3VD~5x?@7jA<<^@7*CpcOh{T<sKcd{!vblYGbB`f$v59f6;eF#q
zxaN3LS}zEi-^LX?)HO72KwOVRS896lv`LSoPHH_bsMXx$N7~P5)y5SB$wl@$Q2L^u
zlr=x7N9@oz*8Iw;US@}ME*xucvSV3kkF{=D^Z^63t{w!_mS|(NLSpTomHo$!Qj8bsHVGGglc~O6`iaH@cF0cq}+>0aLB(P&b)tzI$8gkJpVm(+W#wb{xvop
zQa=A}W_hszeJjaMF8U2ASjUXUX$J8r!!#1!B>eoe&_YySUQs7pGUT@ND)|tvk`Jv`
z@}3$c?@o)3HoM*CF{JRvg+$XDz!fqn{jKzQ1@d;;f-(4va6;q@!8T0ZtpzX)I4^uD
z@C(}^xkOtJr!GqkA>%hkBRsuMXeY8)p~7E#5nnAAhKi8%xFBuWEJ*zMoxpl)88~gN
zu+rOLG42ZUY2|J3V{e1IAkg3E#o7j4c;>j!$ouGSIN#100Bh2^MtV&VTE}TDP^gzaG
zreghM9TFSY&}?E2iNAr$YjX`DJAiR=(+#lkfj?ehXHwFbjsa6T{4TIuhz{Ql82
z7xPPh_7daBgH$THES#34Xx?e&%6fM@y&ypRQc2=NJ4l~0bXID=GB`3_@-QCj(^b|H9VYRbz)DN3
zqRiw@lHtkuUKzn2HnCJ-#~`zTqZ1@$`T5~+O?*{k??Qr67>1*K#aBf39weBBx>(;|
z{9a`5L)UP>X4tBcct&K$fr-*=I5)~qMcpM{ROBv_Vbde|Ou40=+&izcWVke&euUzt
zHsV-8eusv03Lf`oAMW{73sP7G6rE<@gEm4{;o6(V>6jWW77D@#p|EDISQlI$8K>gX
zC^1W9A3}rE#&Z0qvluM0kD#KbSb_&*#J(c?7|J$^-Jo!_=)`NC#hC(}%Q3Bm9X-S$
z1x7;w9WMOZ?0$z@I@;L;nuYu9^QtXgp8Mfe!B)Gf|r_
z&h_5@93ERJ&W9aev1V8}QcM-u7Z5*L?1aTD#CQ=(mx`HOdd^_r25~dP`m4on8I(RG
z#z5s*(Zg?j37LJxFnl>ze2QV=3^9p8ZeOtnba+P0=l9P-)jDwnuAD5+71=q+%oo?d
z;A}AyaxX9oI;M+18QFPowPUYvq=$*@D_E2$K93vci4#S3p%%570)O}+#@oCI&Zoq-
z_wb50QNf`bKdP6fO~y
zFe6C}@J{IOKz~Mjkq>0F$Sy(I48pNIN$kK;ALo7Id(3-6Y|1zup9>}H#1xYpD;b^(
zCWgf1rx(llrRRe2ix`#o}#|RY8Nc
zmNcBYSA14v*Wvxy=C0U%zgQ-+A0aE0-#NtZ`~8TX_A`_(wgh5}
zH^pMJ+*2~_4(A9!gHvLv^y~f!JwQJtE|#xSSHI!A>sTFzeih1-x#G$GjCmBA^^!DCln7I?~suBkY@*i|&V6dyN-wcSK=r<6L{v`GknSil_
z{Q5E+_`6slFcD&h_-(~)H^q@6lOUmr?cP@+4HTIS2|u&RP?_)Nf|%a+qfk7?ZxB8!
zON|t{mt?q{Oucmk)6ce+*uW-T6pVE2GLS9|tkg&{y(;LoQ<4N`g0gR=0Bq(fRf^0E
zd3%H)bo)ymip&Cm>Dm^qw3Vk(oQ*9TOP?sLH~!gN5=5CF@9Y@+oU`uT=9mEGAT)%*
zKRSBBns(AG=77v%!56>xl}<9qsOPf_=HCz=gKK`01|5Q>kC_H#t(@K9W{k5nKJ1pB
z5t$R5iCQ#v36p+M(hX{QnU5JtQ?z5GP??QBzM%iE&BcW=(h8B)1@Cv?YN1Ej;E#h*?=?y!ik@URHT
z-s<$j7V%P3RqiJlj%NaO+X){VDVasJ!OkNvCw;*HU@^bOdG%A^A09Lkt)zT@+a(
zs2V3t!iUqOry1T#mSll7MmAM4F|BKMaJUj#te
z5IGFH#L6!V96dVAvljUYKL)_5Z9;pbWr)PLB_yz{RP*uX_uExbn0haAU4D5%jKd{7CH0K?ci%>Y#&wDWjDm?z*K=vrRb<2E7gln$}=8~TzRhHwa
z?;f>%zvk_m>`bf&R`lXra!u6gV@!K_uXn&bK?jo5zhU4K#^N{*q#`7lR75ZEv{Fyi
zGHw~ec#B*rvjlWH;+k8LB+sSeNt9)cLqnq}ytUqXnq|11%
zkz7Y)1OA?-fpVqmJ
zKIjdZ+l}4e_*K~rrN60u&~SxphofUG1`En6WeTehJ4QQ4%*qa?$Q`G1Ekey~(-
zFUl!2yfiq!-ROrjhVMl75K1d~Uz1VF<=<0KTFbwuqVx>^ei)^7{CgToh5UOuN}Kuj
z43u8t-{~lA=ieE$CE(wgDDCCnGf~>lzaK&A5dWS9mD^<+b}1j=Y?R*Q7w4dKjDOEX
z={S80^O{272{{BK%jM%Do1gDGMcbW^WZLd5KW$DMX(XwGlEVe%v*NH%yLlZhbLh#;~)YtqbM
zI4>Ce(e;yjL8Og>^c(ML3Do~ho{ZCO${?DT_U%1r@Q}DRZMs0VV)We?X#7fK%TSVx
zZdD#98D4M4@rZ%qM@TBZk2MDJHTkjSfn)KU)!1BQDPhsLRaK4HAU*j6YSPb#V5CSq^W
zO5+3*P0!M&jok#crQjLkuksAZu<|Yz4($J|ae*SIONMn*IMT6bDKh>f$gdD`uhP6W
zPF86iPv35QN@Uwhij9IS&E$Q1XUmbp#s)ZHpD|pJ={%Jy@&>xW(Zht%PPb82LescO
ze`mpd;}h~Dl3|s1P&E(GYav+wfbmV5@^JQ$@i}$xW3y(HseF2EE3K40OY6;&3@e~W
zw!~Do%U^>vBPAOyJ7Qcc3;XUlBO;vetOPRWilO{K+XzlHrCrI4
zM6orjY33gdrxL{`kUc__;MzyV`sjMsc)`f_W9*y8ZVY==80mO^02&@Mk{M(!oeP^Z
z@~;a|HuLXt_r#0^&u%z4aOrTC04M!L7R31Gtkt_C0o~Wb@?>iKuoN`lbWxC-&>Ui
zVpfgW-)kP7S7Qwgsj=lpM}>P$_w7SFghWJzMnp#Z)%2PYlzhiE!0oTy;}S>2kz=4$
zD_1NTOp~iyj1Gycwx>o#hTLaBjLHfP^>%TudG@bQM|r}l-;an4uYUiI2{-C*-mfv9
z*7zz26R+{T_SLYckm@URC(c2hiTOeFSB(S0Yc0&GHY3lkHKG3NLDJh^EAn6QuEFH*
zkgR=}n}%z~bZ3;4YH|Hn!>nzgmZ*Ov(|u$8|9q%_gJ{-&hoS%0NauUy>0X}R=Tu6)
z*Fv8XlvN{m|B3AWjp)^4S|faa<;VjZ9dKvz+%G}@rR>g_J#E@w2I>`FrAB!1)<4vb
znYuDir{mKzwBvnU=?>#J_$}l98XLRouJNyR*O0R@t;X3%9++?_JEzv?-kWe14hh4J
zbz`}!@j*XLB!43$G9==D2PC;NNM}SuM@%BmPcnCBn(sJrdMvot^LVf3iHNS5=i%WI
z)pH`k9bGeh-C^GGlBbds+dCziVw9v04TcX%y}hfh4%F$qv(7upk5t243f{Zlo2)dq1klzX6ce3bmctixrMYKDbIGXAXzkAbM
zb2B6~l3dQwbTf?KoRs2ilUk(~`HTE+D*5+nTaDoNLekumlBusqx))-8;3hc(>1Mb)
zi(^D)dT4MS8ZtpMxooQcamV;1&p6LSdOeK%=#gG$J9oHyyxoU}
zQk&KPg}6h>NX7pq$UXM%(9mRZp%W5W)j~{7a$52^la@wwoJ4bGVhY6rOrj4(2c*!o
zaW==9sH9bR!hczAX_<(yH%c()Iai*!hZ_l`)J!+Rga=mx%>hVC9tc7OL
zkFH%jAwj7@6N6G`&zw1F#;ggmrc9r7XBFjhcSxKo#YKMn)*+!`L9WoSaGLbABS^iw
zMVQmO>CAq?ZM#o&Rc{u!PBRZ4(lc&|tNSQda*&IBn0y-}7-kxTcM072m*1e#IO$9?
z-Gr}BQHBWWCr`A~$ttrJGG12}l2^k|hF=~xI@*w^hk2!eGbWN46Xqc&UYKVbO_)%x
zqNBJ9w=k_F0RUi;P;sOS1*iIA~YBYQ-GPa1FL4C-rrz9M_vtT-9QtWtV=El8E1Pgm+d(si;~Y+0j>
z#zjfW5>jafa*FIq@z2C7ofRMQ%5+myGMOr~*abXtOzBQuzU3^I6M?qP26hn_^;DLK
zu(7vdg50^vBkXGoyyVk>p|-*2GP!5o(*mIK1)op(!{2~DO=>{9dY?)GZ!K12#=b=s
zVeQKB=4Z-j#tCtWeTPTR@P266J;C)U*{d@wJ_?lYSLmE)V3+VnCBJ?9E9DhF#5&|N
zD?g~TyF0!&$Rz?NKd{xu#<@y8lhI7Rt%IGA6!nt~+{64=L&GoxihA0pW@l_n8Kj^6CVwD95
z3r>4o$!FXF#D0ThMInpHn+lnbeurJ%9vo1($o}xM6p5u=&gUp|IrikUd4i2YS081g
zmn=6iCfBF5MvA}qRB27V8~qRRjAShH$rVa+lm>LhtHIa78@L5WhmzD0<`0RGyHxQM
zJf@IS#lUVqz*!{Dl9b<(;1MMk6+se+Fl<>pe<+TpCEuOszfk};+4do0nj+&z-zy!M
zAP7*F>`(sc%gQiO5JU+4RXLYmS|a0j*XRT!2ohv=H%>12*vEo%e^OS87TLRQq=tor
zr9!${4TIbl6bT#?$m_YjN-<;JZ^|QzT{es`hi2FH~Y1s{oOrLWPjbn5oKtN<;xonHSYo&jqE!#acJwBh0VKRu0|lF4Iy;*$amlIz>Cg;F84;y
z+}m#T-}kki<&B^FU)KD8*?QJJ5p(}O_J7m-y+`q|sG5U&bac(ZJv6!|u8)>b?-sq2
z%Tp6P)vDXWoqM_x=v2+a{c4ZY|Af9I&lZ%d>TQMDQ1a#94s72~r5Sx9(j1K8jn$I^
z)3B_q*ok3zqGK6@q?=a1f__3i+#c@mhXr4fo9^0L2RY>of)nyaILNo!TqWPC4R8Pkk?D5W@1!YT73A@63Ml~NN(sn-R$Aq}(%E~;zE5pelvbrE9$D2?S4wsfMHWQf3C{5j`4wN)gKK-$F%Z2~
zwP5x$YN^8fF}6@WBFgOv8xPoDR~KT|W_78^La_6*>YD;|6HHFHvR_?*L$|3-jZy=$
z?D8Na@95g&H@nm(Os+2(_Ke|!dzeBA)D>KblFv~H2Tz=7CX_$Sf*^N``ZD(4r_u&4
z0t4SuQy8pTr;^)en`*>Y4yf~tQX|Rm1_TbY(^g9}O@sYqYAA0hYJIBS5N&0gD`E6I
z8ZtYW+d$VMwL7@WP1~XTs_MW_FQ{bxD@+^U8E4I&Y8LrhO09bLZ_
zSSP4xXeN(ywrLHl+G83H>Fd>cQ2C465c{4`4;smDsqYlq!p=W^H0=73x=589ONQ;U
zp-40RfUkb34iRJ?${vH6f2g#1DV}C}7F&O%e!*x97MN~|#7-C0=S^}G$*?~X=_NbE
z@xQBe7#|6bhwlkxd&zWoZkj2Q;nXViyipDy$J4O8&lU-C4|_fZSKau8=gR
z-dIeNP3r~L57+^}`Y^#^8i})2Q!AAP;(E
)?QGM%^VDKJnVhk;p&7i!gxkOkKY6>Y}
zre!4~O`^mmpjK$QC7?iV2*#2iv$tu@KDX&*0XwIfRw!}{$*^|}A3&&=Efnl8q+-zm
z6UAA$Cz#5i{DP?s7FVefjUnCCT9#W;R7X2LAyYXGCO!SA-jWR1i|(hvujITD$g3&j
zXU?z3t=~R)&BtV=HanPJ0GDb`!^)mCS}t1;VNoyYj*wcRK~tC~08lumos38tR>@rlrI
zr|CO#vg#owf6!3firLAgLkzQao8Fe?c9NkanbWO=aZ=8CezM+HGN5<9dZjs%OA;NJ
zg}KOLP3biwL>i$tT1}V-=Z>jepnS7wBUYB0)>`CX+L%59)Z|>=V$O48^bV3?UnhR$
z5`2Baw8)h8f>UoV8QyHgJ8tad`N9>Gb<(1zOzHA`dh1b&VKb4gE;o^`UWA!dYHQ)H
z$Tfs1pPHUyi{U&okI0X|sKCKnkI=%hoau52~WFC;oL)S
zr|>{E0e`({vRc?uU^i3>#JgtNtx9fk*43_Q?eT5d93kXqpXEWI!V>yC24&l6eDv@*
zaj$upEK_jcE3sSvr}2lQ1$j9=^#mmE5Cb9RMKu|htL7|K4yA=7fiKpHFy3iiFR#p>
zrH7RGm~S)rae84D=pD>SkWuOP4xgOb9q}1F-INIX{LF*cYRnvDTEp;YAL2XA5KP~f
zG&0kS%7p~g9M0vpfZ?e?bC^J`*rX9AijZn<9%7Oy+2lYd?>GUkv^P5iwx+~w{z#U|
zSNu$We!V|7k1&71=_*B
zvc5xoZLtJ0*g3)48!p9K{h@yk^M3X$kD7Z13SYKNh5bFOeQ;2md7r?ZgMqEBE^OY%
zd`@J~!z4BFOvGPJaK1<~K|-g$utF4n_Mc-LdHm^OsC6q$f6`=YZu83gyZ)Qz+Mq
zu=B8mA`51jDY9S->@2gyW8ysXPLXZJoo`uWhNea4KLqv?6h~WuvAlLUNXrFpg}Z=z1NgPua+C_?j6P4gkzZa{07^F*WNX26sbH|ZVb5t&U!G){imOkseXu-h(k2f@6zbgJHwHgft1@7Unj9&;qyRhl*Hasz%ilr~DW~AZ3R`0+479Yt
zevK@3%&a?(Z)quF@^O0g1E~1I(hjagk`E(bs^vT@IcOQlAibSsE&C9Dm~P3z!!4)r%m51|4V;0Z6iX~<11;G&FUjJd
zGudzp>CWPTmPTHdehIEomb3U(q9ssdXY&Iu`D4~Ni%y&$VwnZ>${5IAVOh(ELx#)V
zmH=2cz+#8~y)C}{uNZLmu>|DDUo!JP;vi-qsf`}vEUOgO6DlTJHkr=f?5+2p>GOMa
z>_z21OG}uwM|I-!D{1ENMWcc~U*W-(<}3l9Yi(KN#p^;Xx$}^ST~A;aVReZZ2CHV7
z`(aLoMHkuEu==1l4yT4#3Ro?vJ2J9la$+M9n}V3XMN>!1uMBT2vd|&-I|w>yS&FN=
zS{|WGI$e@4xji8sbbnweX9Z7~t#GM_#g7wOHIku{ZKMdGj0kHJ+_}<{D6-4Y?Gv#D
zw#l_@^Ts?MqNREtEd^trwQLgP?`b4tp$xUY24phqh`+D1m_>FCj*hU#LYGeFH)@xP
zcG%{;*v>mCtKjGue!CmLy^~JHNiM5|0WVrE3S^}`I)Uz$ZnCHpnPxr9u-z+`(~RQ6
zkEZf>dYgN}QJXatuWYyMP+2crzt55)$X5uDU-C0FUkI9N837r)MGdp|TWEXmD>MwU
zJdEjwENeyfTft0AU6?w@Y=)N`GYgmAkI4>MFvs#PG+AhFTM%xs!m7if4Yju{w9@?n
z*`=ZjZ_Ow9g{@iUQG6+w3k$Q&hvD3#77v8HZ>eB63UbUIG%dEwV)*h2%V>e!ELd*t
ziv!ComsMkL5``ydOa8m%F&I3_(vtIU*Vc$wW9L1BiYXPUIC_>pQmK^BT%ls?`{9w62
z4@ywBgV@@*tyL#0`%>#>fP`=sGJ>SUX|$I26CaV(}ES(w@Qu&L&n0>6EM#(rHG=cixv$s$a5z
zv!#`S?5);4BAJ7oZLOZBvIMW&bmmV0Mtfq>uV<85>=;A@XK|PIAS7GPnlrHUp-cu7vuvH>!Rlg
zYa52`!>ykP6lv}pZoQ4$US>@gJlx6rG?sL<4rFAD$-7`7t=id2TGbz%v`S)2u&0r+(&WvNu~-5?|GP3y8+g3
z71kK?eiR>u+)SSdcrwvSmhdLEQ)o2~8)e-gP{4WZtU;PJdl}G{t2LI4=UBO*OAkJ!
zYIa*sLe?emI-W_fwqh*s?$iOAI$?NzqIH%kQS|rsJOpV}bxaRsGEh)-RJ!#YnX<*j
z=EyRAGRP=))8UwdmGU>`420=_8>n_N+BF=>?nl%`YEwN6N=s?|mg>|YaY|V6i
zuw>Xc0X!=xe64bYwWTTK=vaM_WVqdh>mPoy6Wi{cst=?rrcu?b#KK|b+5EU5Hlt6w
zYI{97N~}o33KvjY?h`_uinA7e+!BMxHb_hR;;&fRLUwEGJG?bFmQAvD
zVfV;@`ht~$@hA-bM=ng8trrv)N@1~9IyQ!5xz)cTL-%^y5dm+aRgox)y~!~v?E&T-
zw$4>49{b8$R;M6Syt&vBk~gUh`0ZCz9@~7e2P7=EjpR(N@7;hvuL|p7Q|J6?`Vh&m
zbzJq`M-$Z=3*r2?tuYKf{LmUCQw}>NW+nJ?j()^B+7%Q0E#nv_e`b9_VBN4hkTwkX
zGP4yk=-0xwjSnpbc8#_*hakz;6#G?L4~V2AVtU#Z(I((2TWfsPM1Nw-Z>?WS6rL_!
zwkjrhm}FSGs20m$fS;{<
z|JG~xzx5jaN9#2}x}PmStEVA_X(VvQc4AjCN(>Q$#FnBow2&wa68Z?;
zh0a2R;1=2n&4ng{zu+TS1@f=4KiE&~3j2;_eZ|hOPgps7kG;u`u>EW|+s?MILiQY6
z%T}`$EQdYH=CBMll}%*h*+@2o4Pd=k4C~0kSO;1bo3ci%9@E4>#Gk|~;&(=$9Gcih
zEr$wI7)?2(GmOTZP=i7KBPWF5FFC;kujB*~tjuXgr9kAO2;P7HZWH&m
zAb*n6idrkrX-V*%oaO{y&uL2VwH)#U$h&i>T8aE>PGf?ba%km|vo_{5ps(k1>Jxk}
z$DbhNP`MI0D5svmAbpdH3HH?=CD>V~
zDkf5}PWC6sPoGOr)5-89neDUS83e!3rxAQhpGxqE{t&@kdK$s!
z^oazQ>d6GNbuwm(kLu$Hrs-n|j@CyJ9I9uHps#`YaDqK`s!Jkv(#c-?zppwCjs7p?
zY5v3NG=|OpL3J7`h4Yv4H2({$(-@3xb9&I6XqFR0Fd(N3360S=r!$ef59psN4dL1h
zGo_dRW~KDph!WIKDl~ywjl5BJu8vs>p
zY;SCRN41&d;j}W-+FG+RlNZNh+sXGUz3DR;a#PJ?$&F~+B+@p>@ws&-o@`*D9m~~D
zHYZpgCwl=M+$$JddcsD*{{}Gu9A~Z9pi?*7Tk!o#TU|Wa!WJ%2(vxQm#X+=fZCkC%
zlwx!y^=^+yJ(dYP*-0D*y8m#y}aG-_lBRm~rYbTPQpi8pqhvjW-FEBhDXG0@TA^ObQ*91I0z}8HV$LyM@
zk1QB$yKPLQ4#%cK)kkFT8Ps@wrGL80+mg;H!;!njc6P{F~Z|cg#}O8#zT1*
z+l#R1N!vsC$S7N`AWWblG_mCUd}g(+9^}e4ic1)4+oP~#ykhll#LzX#c0ph%khj}L
ziRhDUl!%@Rd7EwRVNJQs3R%-_AEVE7TNTgf(9>*Va6*P{vuL5XK^|V0LRD;_Tc{d_
z-Dla-P4ZaDaDE}^7j0`eccvFN)W^WU#kQ%YhjzEtM-vmhdz4f-_p-eS#Qb9Ohf!I!
zEpie)JUKrvjBJqEHp)Gk0_WO^{t*9~O@?n1Y#Z?CQd>{*48W@{8@b9>*p5-I2An->
zrJdVK+t)l-YRx!Xrhv1bvaOaWQz}!nN0688x)_8R`>ag_So*vzi!!IqTK$8(Tf+|p
zmI3;1+Zn7Zv^Aq7DoDOAQtg4ww)ZHL3eLY{3xKO7M6%#%Hal6dh}KCj*)}O`7Uu1<
zK1^|17SRD2KU2nNfMnkW-S*htWE2as!xlox$7ImU{mixvf7xrZ@dS**M1OL8@3)cT
zdoBdtwui%nZfX%E<&%Ys{Ljl^(A&0G!1|iaiRxRn_qkO=oCigZ*vNcPYWtiLv!LRH
z?Hc~{rj62H7oexic1nQ4P_rNGxL|7pm9j=bMkj5X;o1bn0Sm7yO>N!~y(tqr(S#Hi
z!mX1wI#wUIfyp?Ij@2*)iAg^EFfBeppT!V+!*=xPLds5#*=_4iwyP?e2m5_)JHS{L
zB)nm3iyh9`2C0-jx9FlRN0b-QOF59o?7cDOysbYue;%@xL;Mcg(Awc=!0r9kF0k+)
zwiT4g<=+H9-C;62IS6>b;Www2tni2_@J3BTEPihMjk
z;~{IaL3|t&ZraGxrONgj0(%0_|7_dD@Cjf03I@Rz`$z0a3}kk)V``t--sTOG1~7;#
zF;M0gPYm&I0i^?Ml%iJ0enFz7uH>8cAvoOM{;J5?BgT
zpy%3ugm|RLhgazo1sTi8;#2r3m87T)@vjfX`|Q)f72?;0!s3KJnkSl~cf-O%DGrkg
zVTpO5ueDQ}U32>vB6|vx7C8z@=oZ+|!IF0NY?en{(+i@MkhuJA|WCQFfam>J(
zBkg%2+ladkI>=VwPWNjK3BDAH5}9p3
zuCQ02YCl!`x%U>q7v^$_b-{D8G>{e4aeTn>E~Z3%kygk;yPru;lMLTxLEcKo7KrJg9fFLr_MO~*
zv%9plK8g68J(S-};hN!P`s~47^&Nu+7`)5TA2;l1DA?Hxi
zZu=(2_Q9?|$Ey&~)sX?&-`Q_s;}ZKfjIzX>Qz#6mvV~(l-fCeN1TM@&yn{i^i_#Jp
zI2?{DN<)@9bE-!$+<(;GUt$MP??d~0PDT?3ylub8*g>cW5f*{VSB%EoUG@wCa@#qb
zknycO7p{%8lN-(;z6KQ$!dfhCO7jD9+weGzA%63bXi0RxHn#eqLr`{0Y~d9&Btg>!
zJoa^Zfx(>A3Q3dpGY$%V5_?nsO7`YuOmH*U?CTq&@b+TI}-~WnhoArwEj*
zXeZm6E6I_^$MOd5N^+5b3AU~TUf0RD&RGWOthdP4rhu`fE0bPOW%U;Bf
zVc<&pIT0%N2^7&{5Z}eXT>DVA}
zukv@^C$qTUtF_asIgdjXkJmE%4TYR7fj*W75WK?P23MbO%&Eo^iNMXg0)7h0B1w5{
z816V*JE4kb1q`rL%7{TM2mKPQ`mS&6l@DMw$ct44=s!?=gf`u8@!dHEG^hToMbt~)
z55U<;D1oC^$0Bs~BvFO(bB@N4-9e3j@{xiMxPE3Syu%Nnthb{Z_6TxNFx1Dm>q~oo
z0b?rdyS&{|Jj{7}Ijs4H5`i;z+Gk*Vv}2FJKEQ`Wj~Nm9^trrj#X9m&uKbtun)(u
zehx*EDS!3Xhq$DgyzAzf0}lORNEqtaA%8?Kd?g*-C}
zp+Xn9R^O*76o(4&FeBamRDSWVCM?|NNFpBBu2=3E0>wZW#BYFA2q94ZslyHBTb)$q
z#9s`D@*l`-m^9ix5rfw`t}^gh=%^x(PSG&GBC^18&0fC95z5^@VAKkt+6J
z`C_}9%9p`EH2u)Txrpo^~GE|?At5!N@it+{O^)kf7`q#xVCmclrP8Wn;
zUIzWZr$}SNN3iVK}ygD~LPeDgGPWy&ILQ
zknot$j*o(lOxO6-Sr6YHc02`ded)M~!7n)Ic;VHSe)wvogKCq_*y?zi+&>ZrGh;kG2BJ7>Kk}&^%>b>G6?4J}CXFvBhaNk$s6>x1VuNcgAnkgFa|Q3sdce<
zBCjJ?SxSmS{AefLBSa({hne_
z`M9=}Kchl&q%>mR810n86UDF0<)avhmM{IP1PC}zL7wywH`G{o@sW4g)7j4NaOW+l
zKPR+g<@HUdVuz-EC^8$kS~-`&x$m^uP&~-ri5VL-@_y#j({x74EH=;)fw`BpZB)){
zl$~;9wmK6ayGV%Q7%lWR=YXQg&g+DXSuAmBZ%H!cvtN#_#prXckR)zd@&VmfZCbF+
zzA9g9*TccxMU8s6WBCk)FMllZcpi5_(
zZ(&hdIS=)J-XQE2da(J-Yd0Dk4?M1
zRqU&YRE^2w)X4rYKqLD@Bk)jkN{1c%-&WY2)(d
zFNRRPTXQH!k|!;ug-zlYLPJBM==Vg*xQY%5%P$YB2k*^O%=yoEwL-h+$jY+OCK{~~
zl=>LK3+YC1vrNJ*L6mO^9;gpDhe5q#*_QZ;J&1EbcTe`U}`S$Z!;8~q1fGxvsFvIa8et*
zcH~5!ix`0K(&6UY-*}EL$D@A!}|o!5vvqJ9af%lsAZ};l${DEGn&wtWwB2Rv3
z<4tU=LAu?9R+Rft{YKl+CWPp{w_TyGd+xS@Jh0V)6IYGq{|wo`Bhi13ECu@AhtL0c
zEPH_1{{y_b%c?t^im4I52Ux`|T~gD3Uk$^?eoSlp|3ihRQ7Y{J@ygCjZYqOeQdlG{
zBO#IWMJejxq<D00<}WJo
zztT4h&-f2JCluQLbv^j^2mim5@KlZZAwg;mo<>gE
zd?xYDXA20NE``_D)Jy}HT|0)SCTSGV)e_1!ILSUgStI*=D_FBZqX4dH8U=8X%;a*r
zR)$7qj<(=Tx3+@PGZqI_UU3dBIB#o?g@0;v%*{q;HU$hi)A^pf9q7LZ4WRfdZ4BS2
zlZ7nfS#2c5J)}kA)r%ULM^0sFVU!-F{~`QF9t`IVa^%$aF?o03?V)I+HUV5qH7lks
z)hKwc1LR%NxQI(nK0f=RHq}TmIi5eX_i1F?gcf+UiPOmnUZfCPH#*DV
z+%kz9T%{zT*mNRV+yju
z@+r^(U^Ne%OIm&p)<7K!{7K<3X7qF}V6gsAXE$7MMSGl4!Wi2o-G<5!
z1s5-Q9>~)$8(~tFHbbETfTw=b+#=61llo(3Bj*~?%dz6y+E6wCGhI${0~OAoBML_k
zpJdK?0viYkPHhBi@8VSPSQlpl0k7`U+>B#2oDG76y4nhkQUy6{uSiR<((G);*kDMg
zudS`cYdHx?gp`Xv*q!wli^ohi@A^k_&c*+%jVSST?l($Qnd@40)G#ruIX_hmIS{2&
z6|d{$l;dU7=yD!EdiJBwQ12lM=@509?66IJe&f7KgxF~RhM+BUUIX_plt<^jC8fca
zzX)!~EuawZQ*~$-l=FhVj@{ZX{EcB0GH)z~+zRP>t?+H-vvD9fq;3i$6Z#N?+HKVf}RHa(r^2Q&w0O<|R63
zh%&`zNGY((tc8L0uGS3Bw31xjGR8<{jH%=Dmwf6Myec$8s#-jR)l%MT;vkpwuR;q*
zzb&=7%LpV!Y+*>Ub;v9A6Cv-0kPcZF1Pc-YmWgZ?)AaQL;|IeD~6@Cx%cG4f<1`szsK+7s;0bxv5yI(C2V$8K%
z8?NOt4-U_vQUB~M{>Rl|2$QGK^_fs)7B}J6XPjfHlqi%{IYuGP=PkURXxYz>t#E3$
z5Cj=F1QVC^X1ubfzF+%=G*?TN=5^OUou6>b=3wRuXA==#eTTG9w{M(J@{4n!jA<0t
zyWM$Np@pZak+TEiJ)PtRMri@$eJOS`3&TlvGp{=5^w!zykS@gfKDNwT0
z*$j29Re3BF35gEXng-dm4Kxm6S6D^
zvV-Mpt{fWNT>!p-(t19xaU7RGRR^g(oNMWP`|dEfWi6LNx4GG`Yg=baDE~;KAYFsB
z6k}&-G^ME0xVNzN|I^-;fJaef>r_`)r#owR)va62CLMNUOA|r@1DHTi6of=TfdNev
z5l0Z>!hpk)v>3r*3&B2!2#KPgFp`YGMMVe-DvJ^vR6v15bRL@$MnF`S_umQxaCtu8
z`^Im+c`x7BU#Dxi_ndRjt-ALt|G6NI+Oca6`cwsQr&W(Q8{##3F-_hQH+|uI8e{E*
zYii0*jdhrkj{CN2d1!c=sD8?a+@|dNorA^bfB3?RGF{4ft|G#xe52tLC+|YXcro#e
z?{O90@T?3U!e}v|NYI=ivU)*7YKL=?XztKIRg{^+H_I!r;x*kL=?G~e7^A=$?_3dP`e?YcDff`~V6Bm{Mic|Yr*%d5EQLt6(Ny^D^0#E!S-+V>(R$uIIs*iNLLM~^->Ezm1
zz-mfsr*F_^gTDE6VxAXn@h#dtM*~K@FPxQS}FLT5anp$j|p#GN@
zBO3mY>Z3Qmj?!Z;8;UOOlA^EJB~i|yD1#<>T~XZL8)1cX^)|@13^l%JF1pe(RI}NU
z_9N`G02WeI(bS?bw<_)dS6Xa-!X`BQO6v*CFw)+F6+bpRmn%j6=r-FJ)cPu8(2uSe
z5V*2wD%k}CXXOCJ`_Ch2%C8})#g)ANoD8HiAdEmuh~u)|?20>U(Yvk%_6o(1a7O==
zh2H;v%p-KU_@}ubWdv4z|B}j*`75>89;;u}-2V%T@^3sl@2Yt~{kqB7kGvzCQMQ&3
z`jtxc3y(x;Agi%w|HhBSnkUo$Ydahh|Hj&W>3#g`)cv=37mfbKcadEb@3N0+_)ok>
zf8q6t&^DlKr$t1h!71F)y|{Gl((}T?Iw6k)PO3d6a0(fo-YI%B+4!^gEESWU(Wf9@
z5IB}KD2@aa$8NHZWg@>&o|3qpLgISb8_yTT36Fu$t8*vyMA2h}jzTWW#m+|}VJ=Ku
zrrY3`uh{$66=LUPdGr$eV~%|k)dNF-XatgCOEK;teSsTE)4oYM%D}vYE=wu6JaUKF
z@d&UcYn%Jb?zfDBDnq-PwZigVGYBs6C$g_^viKeJ}OKGLbd#9H37R%TTBj^5BC7WqSf
zHC$J-WxBerW0d`l-iE3d>+#wvXnbvr8EwuaeH3<;7f;31N*IQ`S1I_3zC&EIRsRgw
zA(uchQ9CLEaWugL`VK1f$26-UOn|ThnzF98(F_EN{#AcY#$=)u1Szc2VbWPI?^`e4
zT&t(6$_5G^)LT%yeE^khI8GlZ&aTtPM`~UatTJmElftTScs4F;7m9aARNPg2!sb|e
z9mKpTf}`{uKtw$s<)x=Tj+Bv(&bKHyRu7PCzn(3oZU^uy5G-;|>9VY%eru%iHpMN{
z-xgbU>z!2P9rE?lk5gJ{Y!qeZ={~CbDDnm|aG#FM<9Bfv(ge!)M|&lwcPL_dl|CU-
z(_w9|u|i+cW@I@Z(F;6VpKTWM0mcWA)Ywm6I(bx%^k#gviINGx7_C*CM{Tv)E=nfJ
zqnETWXdit~l;lTFumL@1Qs5rFk|rP2LlpmkK2Ngvz9@MN1R;=BpG;$xDjsp>sfuJA}3B2eX&Zx6)(ljDyF&9YK<|s3y2c_!s{mCW
z3uk@ff<&}%2ITi1;cQ~;^EjC^;$7P)FPgSB_A2g=aP6mecSxowxkd&y@&-2Y`)K0B
z20S($40vqz)5HlzDvd2QqQwoV#ySKu3TGEI>8ON5Bh{!U0%?XF$e5pJVCrWWhh!ze
ziPL2Zy<`gqN$D(q^uZ7H^Q0g(%ryMsnoM~Pfs6eaqp>HAIwCm0_&^1i#EF3hq9X^P
zQOAG4dGV%U2>(z687+sXYKVdId)Wp60S?o~!A3GA-ep9I9>a}tRXIZYw;7En^9=*B
z;v(
z;`bAcWio7VS~mkZ8+pcus&)c_Oi?tWJA~9{sv%_Ez&TyPe8Xu5LLk4UX*U6@IJ1-C
z5wu?okdg!7Pb9{)sB{tegaXqW~P9NIQ=i9YnWkV-v23rIIfUF6y2%4yy>o%QhLPI0J@(`OtTd(NT0hYiv=0
z^ia6hXiF3K8I4vCU~oJ6P$G$82y|3fVhv^QaU$quP*(#4rw^kU6LD?i%}Kut_gd4(SnRDRc?ggUG)rL|&QbZEkM$WXMh
zRtz(t1v{vE>ZPQn0EadawO|uiC(*MtTQ6hM%90q+^qb?JV4@_a0aXQ<4DMqH?z;xq
zowDhMl+%?pqi%OHmq_fw5TY2Ml|5No>cbAGN)zGClub5;w}aKA%KqpqWdPf*s?8GH(}_>BVN6O|~(Z(DGr5weg
z-4I)shgf-Zo5%j#F=T2HPlPYl=&4AL^oV{Bvr>ol2^6`laE_PvwgXJ3{7w{G7ceBS
zmCs_csQ4+?UVN9&P>(c7`BPX!k#@UTju7J%b0W=|0x>5RFxyy;I$mWJY?VW-eS-B?
z;FL|vV@Ug$!Jd;&*{nQ>Ei;dG6=UWwc!iTiu-e2+uU!Fa6Ru#I(B`xAs)CsrV)sz>
z0ybFo>Vn<10DYnlO9}60bwpw}vjS+6Ynde%IvOyNr?4b>zBdv#o?yLTC7#T@vZp?T
zzW2(DI#bExtQ~#2fZ-u0Pk<@EI6jjhVRGwBtdk-UHVdF_Xl4d{OvTJ8zM9JrG!5!H
z%2%1zMFjhpJ00S~zp}OpsmGuJp2@_K+BMrf!Kh;HT261wS(*`!9GX!skOxpa}Wg+-%y>t=S+0atDQ5pxPw
zdQ+HJ_OlU=uaV{o*-j7HPDg>x-d4kIGgfro&fZ4WL;>^2#+%4%dP;(t%NrNLUH=t>
zYv>X!S@Qh#BIi6?jJVzc)&Mnk^*pyVdYC^V%9&f|wtvVn<2S-BKc`pD>T%2I@Ek$mNQH*H8Nc11ihJd>Kq$du<~fmYxA~a^
znMydqMcS8UxkKc=%9<(RC8k$2Xki|-@3mj-qeNB(s}F5>&^$=$3bPSva+@;&a
z@-v~X;Zlg9;n%E+O84QZ;oWEMwnumj`BKdWwi47xF?W(V7pk|`G$c*?q!43mh0B$6
zBuWmeY%K-Y^itC!MiiLOD9QuEx0an(vNUtr~vU
zjHYQ9f7VPlExg_AByZ~~)j3W~sx~L8;R-W`UMyr~glCCgHel<*G|5Gr`1m!mC88WE
zS%$zwHx#4^zkCYsz4C?TE0V=99o+!xD%P9uvF16rUu;@r0*QJ&Wlh5?60&?c4iw&75b)`C+z3AM~=ZQBJ+s(iUOBvpnw7V3FO&uZrThor_2ie
z2bwXE4;M3&`8b(7+_#927P+Z>j7O;}s?zy24s9VCFA-U*xdeji$-j00YxTgL{6X=@
zUi`&KrM^hWXI
z==+Z-@`yY{lnh1RW9j*`{C43R%>Us6&}mL%l!l7m$)joZ99|;c$>v=oQa>Pq%=Lr86@m?P9s48VtR?ZuX=2Q9gZXng)KZ7??-LEXZHH7G)
z4Kg(3Iyrbvy}0jXd{#+IX<}mgAZ0b?%Vm=#;&?V6gYb-4Bt~a%;B^5Gqpe2PLod$h
z{8>Jk!2KGk_>d12OP=I+plGDTd9WoQ>d)suZ(Az|x1C5T<`pU|MhVS1vQw6DEU90k
zjRa|DcXMM~FrT9^Nv*gD;(CGJtLEdWvJUSq*m9nvX$j7V=VEI|^$8dUwRO*Dh5%8%
zt*L!jfSW}!1xXY5yg@tL@L}N|e5LTN=3l!aH%RW1Q>dhZHwL^kA3}4oA=kk5To+;|
zNB&siT;7`ehxs^KoX-=*`onyx{m3n+gyDR%0G~Hul;jv6H~BnK`X=wMC>zCz-8@r1
zxUEU_)xErnh<%&i=#u#6@7wlFdji}<75Dn%DSiUZU-ub*1KhsC`$*wzmISZI2N0^0
z`6gPqgWpVZdU8$F-N^y(xmg5{@BoM#&IgH!AM(c?uucW;;aL0c=JVYW+I+`7wPI;1
z#q#d+&QN2NJ-aNeA9P=CgRW{@2-<@@>7SwOTCw!+e5j&ql}d$;)**gCRkl^H9^V
z$9R#dY^TB(xk>Nu;kn|8YCb{c`WAYiESKk&oY(Qkrz_r?W#%h1X>rSG4!Qzz3AOCmMJmZtJM(`CB5&Z^?W=DlFk?qECz^kd{kX
z-CZUn4s}fsa~X<5IkDn@Q5ulCiK7iH=1_Kp16GFC!Wl8^PqLzQs>lymUpbYQVr)|j
zPolj=$_Xf53k&a^PsETB7Vsjr-)wbo&?oJz7Qjo*^#eBZQtr8(3GJk~`;dt^)~{mj
zuZfEi!`fRfD6mT9*7q7RlfNaZs9M-w?iWKIz!@sfiF1k4PF8;hY*Xc$GYuBJ-tj}k
zqHfkY8%6wdS4mp3n3rLN6i?ObJwte1e-mGGaKQD}az)z%aePKW#gQ(F-K&U(H(AJ)
zKPXCc^$w*d^YlO(%v2_6Pm$QD>A7)xen2OI&I6Rw-+C5it&+N`L0=_VI#oOwhtTB?
zRxW@Lu2JoE!r!Uv^|)4){eU%4OdVuRk*KN4XYt5c_qL6jCdPKPauwma!#d|w4!>|8
zRzJ+UH=|zDVL9>}hyRln;w5QmAW+^^hcapa7vTA%7`$47P%h
z?KgM}WR0^ry0q4Ke%8pAiWXa)#CH=dP1O!TmeoS}GQM9;3cAekUm#*b)@hk^yYrdo
z=2U%aeEd%_L|~|?81|U;0>D_siN036ay9u^=!KNGjP%yNrW3bVW2sA$wW*es8TL~4
zB%Qd`%95GOK&QNto#M+{W8?B_r^JaNvNM~xz)%bMw%3KN*CQoje9_HCN+gP-EwWa7
z&OAOm)D{&MZ?=_(nk=@0?r&aoh1y)iW9cXbF-keUrr5eKMr)6p#|Lq9A{DQ&W_ixd
z&J6{TF?kOT1!?48tYr81Gj0t5;r%K3o=6hA|6(52&?3&FMuv%ets0|O30e{zuMq4bnL|m%KJ?7mC3H&Ji
zbe^KRoE=0$FW)Sc`b~C@mThX3d(!(ZWiLfE{rw!(XS5G3tOSw(8*62%F&A)&I|T*z
z+NY)#rLAu&3p!kID;-7RVL7qlmo*M0Q{@rsUY9GXuxY3R^*d^34uQC
zHvC56tr)+TKjJ$m_Xm-ES0Pn6u~KaH^N!%i=qpNOo37U?y`bT0NJvxmdlbtKozgJFZuk13l}K&L01ZmyTyNPOp^t@
zL-75ru9v*5re8w8-{Ljv3gFX}f`d^4sQf88I1V?8l%lE^UI@*ovWGiB*SXwD;H-(xjVX!4(Uq-ZzHzsmtzVa`+y+l_4h>1eHoGa_^Ym5=hzB%qSUxbJl4E1}p>
dcd>4i->V=c;JwlQnVOb?%liG`vNNFgKLL5Wuc`n5
delta 28671
zcmeFZcYGB^_c(lK%iY~u_ZCP(NuwBQ5=iKfgpRa?j+7)ck(wZ&G?NWTQA$EE2dRmm
zh_r-~LnjeLKuV&BfRrGpfGCM#1>rq&@d=N9{r>Zo-(N4E&pk`F%$zneXHJ>)izCu+
zCudf7sV0-Trs>(g!C4KP%Brbxm-h=sZBkg5Y@50{ZJ^Lc=pl3#Vue;hl+aiR6GDX=
zLRCQ*EP})yv)|Z{>>m4um9fk0JUh!yun*ZmR><<%2W%r-$5yiCY%!b9(%DQll}%z}
z*$6h24Pf!?dDfA&V=Y({){xa@!5j}U+UP~FiP3{#Eu*{1lqS|Ny3ikXqqE5*JTW>F
z{MBer@CPG~;I~FB!OKPr!Ba+Cf*%=e2!3d^CV0eXMR1?dl3;<+oZvR28NrQ46u~t{
zQ-W_BO$g=~kp!0-5d;?-;RIhd8WT**FdFiU(SYDoqdvjOMqPqqjoJi<8=(Y;7{LVN
zjUa+O3}UI!$*4gv#;8WHjS)bwh2c*y((ohL$f!cFp5Y-_({K~4YUl*LhJ&ETuoGm4
z&17N~X$DD&eQTHrerd=A&lwWIQ-(m&l3Clc5+fxvs?32Ycg;GLHULIQ#A@dP^cCJ;m7Wi5LWXi6exjYz`m
zx#tOlbR*!`m4HryW|mF_BocOv>CXi8bz;A4Zn;`^6K+Xzv}C$s#T#XUMBBEoK+}Eb&(k{tK5bN>X#e9#W50jf9koOvNp0
zgqs4yFP0=u%U=2&L6_?KmBHa@k{6wig$IlkLBV|~dQVI7l*o!9u(|XVthdQ6Aoipp
zVW=$L5ZH%MdQxADd8#;3Wi8O@63Yd4xX>%gOl~Qe-kbr%u$I`NidZDDsfv(
z8e!rsMQ$ybHoTn8l*j7n-LJNiOn0WyA5C#Xq&QTNKO%C@z#@P4*{(12h6+0ec^BDT
z&?l=Zl%FODiD0dJPzl@ifJM%g=%Hy5Vp_P})N*#Qj~x
zZX){(iZ_WdkeegAu)L!~hLG8IlJ0kYp%B|f
zyo1|kiC7m3v-jiks`YU
z@hM_!%+D0#MJQSdb*(foRKl&0<6T~Royi#1wFn79`
z#2_<4>;R2(#cclk3RG+q7vka+@fDF>h1AvJGU&ZfOohyw%!PkF_LLjI0+;+dvd;<#lPKM!+t*vqUJ(7s_C?dLPRI}*F=8!+c5)Z?7u?)OcF7{RB4wC6|s;~FJiI&z_
z@VnSckbk3|pFn}(Hwog``1QmikHn55Ghy6(ziteBGO18t4C3DK+k{&rX^_YSNT^^t
zu~3zIicExrpV?R_`@}C8ViO%lAV1r$7rt$mYAA9?$#gH7x@!fR-BA~-RgrE9X47L@
zh0GYDx=1yBbI_9jNfMX>#rLHktW`rQ6PXHG2ZV+g5iETsG7UmNe~(Yo3ZN=Z!@6~(
z3kvIme>Ri^QReHn4dXs^Re9DP;aIXks1CiYdS_VHRGP}{kh)j!;@uk3Sq3TX+yyX0
z6c<2wkfcN7=F;cP0mZ#tG4N=tD-6fCkXDM!39boxOKjUl`d*PcOQvgS$Qnrxsp&&*
z3lzPfpWtSMm40q8LR_!ltgg~Rk$Hgap{{c^*H}*92)xrnswOfoL~3#vKHUix+St|P%&B>jpHXtZ!vuQk|YbPIOQ`?x+BC`4gIm>&KQ>ZbUpYXCQ5+(8g@OuEE-R7BPg
z63)6VRd&}vDBLXt%B(vE?UTv`IgEM<|1a)wa}kPBi2S!crZeB;SV?S-MAUH~rA_`v
z2dAZKvfSfeIM~1OGwIYd&h4gOTKJ%)2`4>#D`SOX`Ny
zNs)U}f8mvqD)32)Y&+H(;uhMxTs6u>K7v#(gEkoVm8<7J`b?)$^pWm+-j>@cwRy)S
zBILf~=eyYsN?-E-2GUa2NNn;Kh0X
z#zxD#eFV1$V*@GczsPVdV;wjSG)>rKnkG6zWQ=;QQg*L1jQ7YzGV6`50Qm<&j-@`j
zU~-Coe;+?L`I_$vS;%q!pDL2h%n`JGVckGKCf&pG+OkJv&;L75>&bBni$`aqTrSAm
z)b5G8B$GKuEac`K>jkMzr9iIm#G;Y|f`i}e4S5HIU?A*2@M
zSxzA4b+2UJhl0#4{=Tp}McoMZW?6J7n#1SK6iXEWfA1w*80!Z;UbalZ>G5(GmG#BL
zgXD)y8nCKqA3XGe+@8sOsDXj7CDj~=p+jX7&;ZHwX%|S{ZH|G{zseC%q-%aqJyUkT
zkx_E6I%Ijv{*r0qEBuXiu#71VXgXScpbnnfzn^4U5dQ2w&Ke^xWb6gV8dH_5y|MCL
zg$+e1MSda*!@|IIR`z1RRGDnR;V8XIcUdANPnFL>E2nCMlxeaIgQm$_aM>Jrs+lE&
zK2NR!@e5@eBrTM!7%@-QRC%Ce+CJmou*FXo%Z)@iiO3rTH+Gx-kZ8Cqve785;C+oj
zX(hkDh|(H<9g9*fzrKXhMt&WK();{69;L1PIsv78ew~QYZhoCab^*UmM(H5Grl3^B
zuc;^<p{5Wa)b(Gj(LV6<{8V
z6C^W;mW*y)diCzpsb0OdknS{lY4J9HC9=6F*~}5DJVY{m*no>57V>A2PTcKg4pFF^
z*XM`4fY-g|+9I0|smbOD2#hf|z(jxZMv*N5*9F2UbB13toLtYGB|!dob382TYfgpm
zcr)$6Ol%>zhP%kl2{!Lh*c%Yj+guEvR5wSXvz@tuL0T*Ge8}%(UdG>j6AE55_lEf4
zw2RymZO8ksBFIbWVKx@GF!yHIx2HK@U@Izn{fkN@D*H0wtr5U>nqT7#nIjes
zG7pgDM9K8Vz{)0{$FGN(?+9!JoJ%r)uD-pfXR>6<4tn++&ebq?;Idgc*OY|mBg}_1
zHVWHKFxv!qq-2^ux$@QSczKe!9%F03Iaq!Jm!_C|sPY)e^nq6SN&vQ)VU7^gby@0Y
z$@I=M%6iMIsf+c{c8Yldrpz`kRcVwxnP=`U$zuuMXPx*%#4qM1cxjQjDj#^|i_ME9
zX&k)*6<2Msuw#}v;OQIca`QvR-i5p|G$B>rLgGzYVNTR&a2BmK#|Ug=POkY^d4gnG
z{0s{xcF!}dTU8*~H3Lo>L0uRh=T47D8T4YwXi@`Dd^!NwVYX$IY+F!mj_?
zCL(PUYth5Y&WE)iB0*Qwg#LDWsxvxs2B#zhWNLHb3?^INKX_cD8FJ3
zz~EBzO*1RRxYOnsh8-@MX@`zby~Iqek2KmE2KMu>0&foSZ~N@SP4uD4renn|a}9w_
z1IM>C;Pw>WHt&?AS0&R5NNz`1JAW{Dhq&*}3)BOP8@?i$Ru1#ghjhQ3v3-T*=Fen#
z1`+x6zVCe;@r$`ok!MOK=wLPF)UnmCgwR!N>MnHK#u
z(fg#3pXVP8MRm+hbeWYO8968tuGzvMsh8yioUbZdRe6qN+M-l)JOGkm?_I-$|8T&0%iV$*GPtcp-Ihq@UB;>CZZIq2$FQ3oMZIbDP?I$8Yxp3DD9&R
zf_gRloOmF_zb3=Px=Jo%ALWE8D3e*Stnbq|2t})n`Z>9b