]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
4 years agoTest case updates. avoid-bad-indexes
drh [Thu, 22 Oct 2020 18:16:17 +0000 (18:16 +0000)] 
Test case updates.

FossilOrigin-Name: 27c681c9c6672ad7098d8ff2c41e76d3e9e55866b6327ed85e73f63bd623ceed

4 years agoSometimes it makes sense to do a full table scan rather than try to use
drh [Thu, 22 Oct 2020 15:47:48 +0000 (15:47 +0000)] 
Sometimes it makes sense to do a full table scan rather than try to use
an index when most of the rows will be selected.  This branch is trying to
tune the query planner to make that happen more often.

FossilOrigin-Name: 0f42099ad65855c94af8472f3a6fddac7fc2a82e8fdfcc06a298eb6683a28688

4 years agoFix the sqlite3_hard_heap_limit() so that it works with sqlite3_realloc64()
drh [Tue, 20 Oct 2020 14:40:53 +0000 (14:40 +0000)] 
Fix the sqlite3_hard_heap_limit() so that it works with sqlite3_realloc64()
in addition to sqlite3_malloc64().  Improvements to OOM processing and
debugging aids in the fuzzcheck utility.

FossilOrigin-Name: 602d7369166d406a26834aa47d71d565a17d377d32e41f308821a50b41f91896

4 years agoFix an assert() inside of debug-only code that can fail following an OOM.
drh [Tue, 20 Oct 2020 12:37:51 +0000 (12:37 +0000)] 
Fix an assert() inside of debug-only code that can fail following an OOM.

FossilOrigin-Name: 79da254f41a0d7d5fdc57f0cc40b3560bfcf7f79eed24a9fada1b6b4ca3adb5a

4 years agoFix an incorrect table ref-count in the new recursive CTE logic that might
drh [Mon, 19 Oct 2020 20:49:54 +0000 (20:49 +0000)] 
Fix an incorrect table ref-count in the new recursive CTE logic that might
result in a reference to freed memory following a syntax error.

FossilOrigin-Name: 75a0288871ccb2a69a636cbb328fe19045a0d0ef96a193ecd118b9a196784d2d

4 years agoEnhance recursive common table expressions to support two or more
drh [Mon, 19 Oct 2020 12:35:08 +0000 (12:35 +0000)] 
Enhance recursive common table expressions to support two or more
recursive terms.

FossilOrigin-Name: 77e64647ec429c6e0d884abbd00dabebe738f89544a4984d6fd7a702b928ccfd

4 years agoNew test cases for recursive CTEs with multiple recursive terms. cte-enhancement
drh [Mon, 19 Oct 2020 01:44:43 +0000 (01:44 +0000)] 
New test cases for recursive CTEs with multiple recursive terms.

FossilOrigin-Name: cd5182bd6f5969ba0812275f471224908296960358013327cebbe0c52b820f04

4 years agoAllow multiple recursive terms in the compound SELECT of a recursive CTE.
drh [Mon, 19 Oct 2020 01:23:48 +0000 (01:23 +0000)] 
Allow multiple recursive terms in the compound SELECT of a recursive CTE.
This facilitates writing a query to find find the connected components of
an undirected graph.

FossilOrigin-Name: 5481fa8c79c34f434e99ab633ff3d0942a309a74fb0cf38e3d3617b51d5d21dd

4 years agoFix harmless compiler warnings.
mistachkin [Sun, 18 Oct 2020 18:35:34 +0000 (18:35 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: 7f8802bb7be61fdf7c7a591945d533d848bc46d2989f7739dd9ad89e1b6a9c65

4 years agoFix the SQLITE_DESERIALIZE_FREEONCLOSE flag so that it works as it is
drh [Sat, 17 Oct 2020 22:13:16 +0000 (22:13 +0000)] 
Fix the SQLITE_DESERIALIZE_FREEONCLOSE flag so that it works as it is
documented to work.
See [forum:/forumpost/ba1dff667a|forum post ba1dff667a]

FossilOrigin-Name: d6fac8a1d3efeb2c4f03dae437b5b314765c93770a70603803a8039291dbcabb

4 years agoFix an incorrect printf() in debugging logic in where.c.
drh [Sat, 17 Oct 2020 19:09:04 +0000 (19:09 +0000)] 
Fix an incorrect printf() in debugging logic in where.c.
Problem reported [forum:/info/80a9c47769772207|by forum post 80a9c47769772207].

FossilOrigin-Name: 883da4dadc88809192e4ed2f753f8883471fb43aa330bc58b017c66e1acedc6c

4 years agoMinor fixes to the cksumvfs documentation in the header comment of the source
drh [Thu, 15 Oct 2020 17:59:38 +0000 (17:59 +0000)] 
Minor fixes to the cksumvfs documentation in the header comment of the source
file.  Enhance speedtest1.c so that it can more easily do performance
comparisons of cksumvfs.

FossilOrigin-Name: ed3bb818f58b75c087f2875331ec944397b6c61a5b14d8af4b9ec6f376bd1872

4 years agoThe windows VFS accepts query parameter "exclusive=true" to cause it to
drh [Thu, 15 Oct 2020 14:37:27 +0000 (14:37 +0000)] 
The windows VFS accepts query parameter "exclusive=true" to cause it to
take a mandatory file lock, preventing other applications from even
reading the file.

FossilOrigin-Name: 05b573fdb27abec7d75aa1375325d45043cfd674f5b346fb341f001d7e04d160

4 years agoEnhancements to TclKit batch tool for MSVC.
mistachkin [Wed, 14 Oct 2020 21:31:20 +0000 (21:31 +0000)] 
Enhancements to TclKit batch tool for MSVC.

FossilOrigin-Name: 2a8a4552112be6e39e3475e9a8579582b5157086d3efd37971463c0e3958068d

4 years agoFix typo in a documentation comment.
mistachkin [Wed, 14 Oct 2020 21:30:56 +0000 (21:30 +0000)] 
Fix typo in a documentation comment.

FossilOrigin-Name: 462adc7d6b14de3862c2a3e57dba7efaf2ba9c104e1c127a5801a7b892059872

4 years agoEnhanced documentation for sqlite3_vtab_nochange() to make it clear that
drh [Wed, 14 Oct 2020 15:46:29 +0000 (15:46 +0000)] 
Enhanced documentation for sqlite3_vtab_nochange() to make it clear that
it is an optimization and that virtual table implementations should be
prepared for it to always return false.

FossilOrigin-Name: 3e2643619d122616663688533977d6c60d45a269b4e2bdc330fd3ee5d39f2e03

4 years agoFix some fts5 problems with signed integer overflow causing segfaults in -ftrapv...
dan [Mon, 12 Oct 2020 18:09:16 +0000 (18:09 +0000)] 
Fix some fts5 problems with signed integer overflow causing segfaults in -ftrapv builds.

FossilOrigin-Name: 7e17c2f4b7dc9b563d0b4da949bb134dc7c4fc9c86ce03891432a884ca6409d5

4 years agoImproved quoting of the table name argument for the ".import" command
drh [Mon, 12 Oct 2020 17:57:29 +0000 (17:57 +0000)] 
Improved quoting of the table name argument for the ".import" command
of the CLI.  See [forum:34591fefbe|forum post 34591fefbe].

FossilOrigin-Name: ce97b56d63d6e03b909e049a0a62251d98c7bf643448193a28b42a5871899387

4 years agoAdd options --data-only and --nosys to the ".dump" command in the CLI.
drh [Mon, 12 Oct 2020 16:54:28 +0000 (16:54 +0000)] 
Add options --data-only and --nosys to the ".dump" command in the CLI.

FossilOrigin-Name: 57123b14a71027c21cb5eee089fcbc9330d07bf9091b01aecc4f9e3b9e4f7b09

4 years agoFix ALTER TABLE so that it can run even if the schema contains unknown collation...
dan [Mon, 12 Oct 2020 15:27:50 +0000 (15:27 +0000)] 
Fix ALTER TABLE so that it can run even if the schema contains unknown collation sequences.

FossilOrigin-Name: bc4bb9433fed519386511796cce475d74100b8ed707cdbffd8cbdf683b0faf35

4 years agoAdd the --nosys option to the .schema command in the CLI.
drh [Mon, 12 Oct 2020 14:56:47 +0000 (14:56 +0000)] 
Add the --nosys option to the .schema command in the CLI.

FossilOrigin-Name: b72ee694532c0c5d2285dd580154546eb592fd6892cad9ad7a49e98737adb974

4 years agoFix UPDATE FROM statements on virtual tables that are declared WITHOUT ROWID.
dan [Mon, 12 Oct 2020 14:29:11 +0000 (14:29 +0000)] 
Fix UPDATE FROM statements on virtual tables that are declared WITHOUT ROWID.

FossilOrigin-Name: bcb0bc6a7b7006f07adb7266b1fecca39bf85a0adea6d78a341623a3546f2c2a

4 years agoFix BEGIN IMMEDIATE and BEGIN EXCLUSIVE so that they work even if one or
drh [Mon, 12 Oct 2020 13:24:00 +0000 (13:24 +0000)] 
Fix BEGIN IMMEDIATE and BEGIN EXCLUSIVE so that they work even if one or
more of the database files in the connection are read-only.  Test cases
for this are in TH3.

FossilOrigin-Name: 2fa08c3963f008d4723c3f4f4496abcb6d4b575c85ba4a911a6aed5730b5948b

4 years agoIn the CSV extension, use SQLITE_TRANSIENT rather than SQLITE_STATIC on
drh [Wed, 7 Oct 2020 11:24:45 +0000 (11:24 +0000)] 
In the CSV extension, use SQLITE_TRANSIENT rather than SQLITE_STATIC on
return values that can in fact change.

FossilOrigin-Name: 54b54f02c66c5aeaa3504c52a04614e2fb4d7260da8367840d5ea5a71cdc2fda

4 years agoAllow fts5 trigram tables created with detail=column or detail=none to optimize LIKE...
dan [Mon, 5 Oct 2020 16:41:56 +0000 (16:41 +0000)] 
Allow fts5 trigram tables created with detail=column or detail=none to optimize LIKE and GLOB queries. Allow case-insensitive tables to optimize GLOB as well as LIKE.

FossilOrigin-Name: 64782463be62b72b5cd0bfaa7c9b69aa487d807c5fe0e65a272080b7739fd21b

4 years agoDo not apply affinities when creating entries for automatic indexes on views. Fix...
dan [Sat, 3 Oct 2020 19:16:36 +0000 (19:16 +0000)] 
Do not apply affinities when creating entries for automatic indexes on views. Fix for [95302bdb].

FossilOrigin-Name: df12f097224ebc9473d9e2a8933bd7efed6490d09af2c012c9b59a7892369b7f

4 years agoFix a segfault caused by running "column LIKE NULL" against an fts5 table using the...
dan [Sat, 3 Oct 2020 17:06:02 +0000 (17:06 +0000)] 
Fix a segfault caused by running "column LIKE NULL" against an fts5 table using the trigram tokenizer. Fix for [e33ee62575fc22].

FossilOrigin-Name: 6e72a08de764077f2bba6f7e3b99ea29001941671a971f2ccf7ceeb9c682fb1a

4 years agoFTS5 does not handle tokens that contain embedded nul characters. Prevent the trigram...
dan [Sat, 3 Oct 2020 14:36:06 +0000 (14:36 +0000)] 
FTS5 does not handle tokens that contain embedded nul characters. Prevent the trigram tokenizer from returning such tokens. Fix for [2ba5930b2].

FossilOrigin-Name: b1d048748c054575425a4bebf0c5d09962f9329d5ce6a978cf54e508b238584c

4 years agoFix some test code so that testfixture can build with SQLITE_OMIT_WAL defined.
dan [Fri, 2 Oct 2020 15:15:18 +0000 (15:15 +0000)] 
Fix some test code so that testfixture can build with SQLITE_OMIT_WAL defined.

FossilOrigin-Name: dd009cd7aec3598e930806907601f4f0f9b0021ea99fa6c5e29e88f1246066ed

4 years agoAdditional corner-case fixes for the in-scan-vs-index or OP_SeekScan
drh [Fri, 2 Oct 2020 13:48:57 +0000 (13:48 +0000)] 
Additional corner-case fixes for the in-scan-vs-index or OP_SeekScan
optimization.

FossilOrigin-Name: ad5ab24ebd557e7af1d92ab3fbcb3747c04da5ad4ed779fb6391dc94042687dd

4 years agoRemove an incorrect assert() from the OP_SeekScan opcode.
drh [Fri, 2 Oct 2020 12:49:06 +0000 (12:49 +0000)] 
Remove an incorrect assert() from the OP_SeekScan opcode.

FossilOrigin-Name: c0400f8c0bcb85ba39004feff753eae2f8e82065539e52b5788febd7644c417b

4 years agoFix a faulty assert() statement. Add new test cases.
drh [Fri, 2 Oct 2020 12:42:51 +0000 (12:42 +0000)] 
Fix a faulty assert() statement.  Add new test cases.

FossilOrigin-Name: 80ecdb3da4558bb08ee3ec6edbde906ad5b3b8182e672b5ba0d5dfa8041cee0a

4 years agoFor the OP_SeekScan optimization, the OP_IdxGT does not necessarily come
drh [Fri, 2 Oct 2020 11:55:07 +0000 (11:55 +0000)] 
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

4 years agoDisable the OP_SeekScan opcode of the in-scan-vs-index optimization when
drh [Fri, 2 Oct 2020 02:02:18 +0000 (02:02 +0000)] 
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

4 years agoAdd experimental "trigram" tokenizer to fts5.
dan [Thu, 1 Oct 2020 17:24:36 +0000 (17:24 +0000)] 
Add experimental "trigram" tokenizer to fts5.

FossilOrigin-Name: c4e8ec7907de7cb9e610ef9f4930caf5c046618151fb4f61d5716b9fa3f31423

4 years agoAdd the -trigram option to the fts5txt2db.tcl script. fts5-trigram
dan [Thu, 1 Oct 2020 17:15:12 +0000 (17:15 +0000)] 
Add the -trigram option to the fts5txt2db.tcl script.

FossilOrigin-Name: a394dd260252e7b7dcbc90fd321dfd40d9375f0598ea52b01001c568cbdbafce

4 years agoAdd tests for the trigram tokenizer. Fix minor issues.
dan [Thu, 1 Oct 2020 16:10:22 +0000 (16:10 +0000)] 
Add tests for the trigram tokenizer. Fix minor issues.

FossilOrigin-Name: 897ced99b44085012aa44d3264940dcbd4c77b295a894a1b58fb2c03a0f7fee8

4 years agoFix the OP_SeekScan opcode so that its variable names do not cause problems
drh [Thu, 1 Oct 2020 15:46:21 +0000 (15:46 +0000)] 
Fix the OP_SeekScan opcode so that its variable names do not cause problems
for the test/vdbe-compress.tcl script.

FossilOrigin-Name: 7a78274a072324b94d6f79e5b7a198b2fa9321ff5d6a528b51f57d3ee95c765b

4 years agoRemove a debugging printf() accidentally left in the previous check-in.
drh [Thu, 1 Oct 2020 14:38:39 +0000 (14:38 +0000)] 
Remove a debugging printf() accidentally left in the previous check-in.

FossilOrigin-Name: e9d1efa597fb073dc4bc4286e03059a350ed05d3e6476cd3247e6cde626f458b

4 years agoThe IN-early-out optimization does not work for virtual tables. Do
drh [Thu, 1 Oct 2020 14:36:15 +0000 (14:36 +0000)] 
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

4 years agoAdd experimental unicode-aware trigram tokenizer to fts5. And support for LIKE and...
dan [Wed, 30 Sep 2020 20:35:37 +0000 (20:35 +0000)] 
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

4 years agoImproved query optimization for multi-column indexes where the second or
drh [Wed, 30 Sep 2020 18:06:51 +0000 (18:06 +0000)] 
Improved query optimization for multi-column indexes where the second or
later columns are constrained by an IN operator and the earlier index columns
limit the search to a small number of rows.  Use the new OP_SeekScan opcode
which does scanning of the relevant range of the index but gives up and
falls back to doing a seek if the number of rows scanned grows to large,
in order to guard against pathological cases where the estimated number
of rows to be scanned is far too small.

FossilOrigin-Name: 4a43430fd23f88352c33b29c4c105b72f6dc821f94bf362040c41a1648c402e5

4 years agoFor the OP_SeekScan opcode, adjust the number of steps run before giving in-scan-vs-index
drh [Wed, 30 Sep 2020 18:03:22 +0000 (18:03 +0000)] 
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

4 years agoBack out the incorrect optimization of check-in [e51ecadcbdef5ce6] as
drh [Wed, 30 Sep 2020 17:32:22 +0000 (17:32 +0000)] 
Back out the incorrect optimization of check-in [e51ecadcbdef5ce6] as
ticket [5c4e7aa793943803] reports a case where the optimization does not
work.

FossilOrigin-Name: 7395e96b8cc370c8ac2657fb805915b0992a15d80f8bf256d277b423fec64675

4 years agoIn the query flattener when substituting expression Y in place of expression X,
drh [Wed, 30 Sep 2020 15:36:03 +0000 (15:36 +0000)] 
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

4 years agoBetter understanding of savepoint code
shearer [Wed, 30 Sep 2020 09:17:53 +0000 (09:17 +0000)] 
Better understanding of savepoint code

FossilOrigin-Name: ce6d8d621505f25e4fd43e7cf27445e1a2ddd58d79108d63499c2ae30cc9f610

4 years agoAdd an sqlite3FaultSim() call to btreeNext() to make it easier to
drh [Wed, 30 Sep 2020 00:48:45 +0000 (00:48 +0000)] 
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

4 years agoIn the OP_SeekScan opcode, changes to pOp must occur after the call
drh [Wed, 30 Sep 2020 00:10:22 +0000 (00:10 +0000)] 
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

4 years agoThe OP_SeekScan opcode is a no-op if the cursor is not pointing to a valid
drh [Tue, 29 Sep 2020 23:52:25 +0000 (23:52 +0000)] 
The OP_SeekScan opcode is a no-op if the cursor is not pointing to a valid
row upon entry.

FossilOrigin-Name: 4afc96b5fe80bd192a23e0230edc207e641931c3bf48296b1a385c786386f1b7

4 years agoCoverage testing of the OP_SeekScan opcode. Fix a problem that comes up when
drh [Tue, 29 Sep 2020 20:22:19 +0000 (20:22 +0000)] 
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

4 years agoImproved comments on the new OP_SeekScan opcode.
drh [Tue, 29 Sep 2020 17:29:11 +0000 (17:29 +0000)] 
Improved comments on the new OP_SeekScan opcode.

FossilOrigin-Name: 6110fdd5bb7b4ae5c065404c802ae726362ef084966b73cffe58c4bfb98689d2

4 years agoImproved performance by manually in-lining the sqlite3VdbeIdxKeyCompare()
drh [Tue, 29 Sep 2020 16:05:09 +0000 (16:05 +0000)] 
Improved performance by manually in-lining the sqlite3VdbeIdxKeyCompare()
routine for the OP_IdxGT opcode and its kin.

FossilOrigin-Name: 2206a2c848a122ee220c89427f9be0460cba0706f58852139d7b37184ce29a29

4 years agoTypo fix to repair the early-out optimization. Also avoid unnecessary
drh [Tue, 29 Sep 2020 15:32:54 +0000 (15:32 +0000)] 
Typo fix to repair the early-out optimization.  Also avoid unnecessary
OP_SeekHit opcodes.

FossilOrigin-Name: 8fd7d8dfcd515aa6b65d6eb27b033d3b3a31db467b9100cc13c62bc60113019e

4 years agoThe OP_SeekScan opcode works, but using it requires disabling the
drh [Tue, 29 Sep 2020 01:48:46 +0000 (01:48 +0000)] 
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

4 years agoRevisiting the IN-scan optimization to try to fix it for the corner case
drh [Mon, 28 Sep 2020 19:51:54 +0000 (19:51 +0000)] 
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

4 years agoSmall performance improvement and size reduction by reducing the size of
drh [Mon, 28 Sep 2020 15:49:43 +0000 (15:49 +0000)] 
Small performance improvement and size reduction by reducing the size of
the WhereTerm object.

FossilOrigin-Name: 43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5

4 years agoAvoid the possibility of integer overflow on the --pagecache option to
drh [Mon, 28 Sep 2020 13:34:05 +0000 (13:34 +0000)] 
Avoid the possibility of integer overflow on the --pagecache option to
the CLI. See [forum:10a2892377|forum post 10a2892377]

FossilOrigin-Name: d3d13df31a97648f952beb2e1a783f947a80ec843227985ad9ebd14452d2f654

4 years agoFix harmless compiler warning seen with MSVC.
mistachkin [Mon, 21 Sep 2020 20:18:44 +0000 (20:18 +0000)] 
Fix harmless compiler warning seen with MSVC.

FossilOrigin-Name: 4591ee03d7a1ef3f0f6ad0629493fdb7a1c0ddb3277a9e87aa244cb0ca770593

4 years agoIn fts5 integrity checks, do not compare the contents of the index against an externa...
dan [Mon, 21 Sep 2020 14:53:21 +0000 (14:53 +0000)] 
In fts5 integrity checks, do not compare the contents of the index against an external content table unless specifically requested.

FossilOrigin-Name: 782163693f37aeb65209bebbaeb6659a36881b8c4b4bec778b366658488bf966

4 years agoRemove a new assert() that the compiler finds is always true at compile-time,
drh [Sun, 20 Sep 2020 13:33:28 +0000 (13:33 +0000)] 
Remove a new assert() that the compiler finds is always true at compile-time,
to avoid a compiler warning.

FossilOrigin-Name: 8bbaee238593741da107b92b254cb5f0cf8b6bcc760bf2b25d20e46c8edee2a9

4 years agoAttempt to silence harmless static analyzer warnings in Lemon and in the
drh [Sun, 20 Sep 2020 12:10:28 +0000 (12:10 +0000)] 
Attempt to silence harmless static analyzer warnings in Lemon and in the
Lemon-generated parser.

FossilOrigin-Name: de8ce22a46c90afa5475cd24c28b7a82b26410dc72d662af2f9d9e5e528e0eec

4 years agoFix a typo in the documentation comment for sqlite3_preupdate_hook().
dan [Thu, 17 Sep 2020 21:11:25 +0000 (21:11 +0000)] 
Fix a typo in the documentation comment for sqlite3_preupdate_hook().

FossilOrigin-Name: 4542d194e2fef5e21e1c3679914bd9e21fab31cfb111cf640524fb3514a8afa3

4 years agoFix a problem in sqlite-expert causing it to ignore equality constraints on the secon...
dan [Thu, 17 Sep 2020 17:01:16 +0000 (17:01 +0000)] 
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

4 years agoFix a problem in fts5 causing the in-memory hash table to be flushed more often than...
dan [Thu, 17 Sep 2020 15:16:50 +0000 (15:16 +0000)] 
Fix a problem in fts5 causing the in-memory hash table to be flushed more often than necessary.

FossilOrigin-Name: 9a55601d072bcd1ac0f6f1633216c7c8b3ff3e037451e2cfd285cbe19b60b9fc

4 years agoFix a "jump depends on unitialized value" valgrind/asan error in fts5.
dan [Thu, 17 Sep 2020 14:16:02 +0000 (14:16 +0000)] 
Fix a "jump depends on unitialized value" valgrind/asan error in fts5.

FossilOrigin-Name: 66f94d623c16b4527e42f0519e32ec78eaf9ee6fd61ee7d0eb657cc59a8f7d68

4 years agoEarlier detection of corruption in the rtreecheck() SQL function to prevent
drh [Thu, 17 Sep 2020 11:56:04 +0000 (11:56 +0000)] 
Earlier detection of corruption in the rtreecheck() SQL function to prevent
a (harmless) read of an uninitialized value.

FossilOrigin-Name: e2074b24788149562b15022ccd2784d6649f08ebc41410e3bfb2401baf0892e2

4 years agoPrevent use-after-free of the u.vtab.idxStr string following an OOM
drh [Thu, 17 Sep 2020 11:32:14 +0000 (11:32 +0000)] 
Prevent use-after-free of the u.vtab.idxStr string following an OOM
while generating the OP_VFilter opcode.

FossilOrigin-Name: 751fe4edb2d4602e652523c2759de3f4fffd29d5c66cae68caf45b30fd8b750a

4 years agoDISTINCT may not be ignored inside a UNION ALL common table expression.
drh [Thu, 17 Sep 2020 00:46:09 +0000 (00:46 +0000)] 
DISTINCT may not be ignored inside a UNION ALL common table expression.
Fix for ticket [c51489c3b8f919c5]

FossilOrigin-Name: 7d2b590d3abd66a7e6ae9046198eb669e0fd2f223f7691281e9ad795a12b8903

4 years agoFix a pair of assert()s in "PRAGMA foreign_key_check" that might have given
drh [Wed, 16 Sep 2020 19:48:23 +0000 (19:48 +0000)] 
Fix a pair of assert()s in "PRAGMA foreign_key_check" that might have given
a false-positive following an OOM.

FossilOrigin-Name: 9ea3039b538ffd0f348c8fbc9452af1fbf899a1f668af9a2404bdd0f8dd21351

4 years agoFix harmless compiler warnings in Lemon.
drh [Wed, 16 Sep 2020 16:55:56 +0000 (16:55 +0000)] 
Fix harmless compiler warnings in Lemon.

FossilOrigin-Name: 6c94ba4b1c16b676978808dcb24f63c2f22915af5dcfe9f635c037011affcf4b

4 years agoFix a buffer overread found by OSSFuzz that could occur if a WITHOUT ROWID table...
dan [Tue, 15 Sep 2020 20:48:30 +0000 (20:48 +0000)] 
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

4 years agoDo not invoke usleep() for more than 999999 microseconds.
drh [Tue, 15 Sep 2020 12:29:35 +0000 (12:29 +0000)] 
Do not invoke usleep() for more than 999999 microseconds.

FossilOrigin-Name: 1f5ed852f25515bbc0a7aaf236fdef40fa7e31805eee1249277fde4e68f95130

4 years agoCatch fts5 index corruption caused by issuing 'delete' commands with incorrect data...
dan [Fri, 11 Sep 2020 15:01:49 +0000 (15:01 +0000)] 
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

4 years agoTry again to fix the typo in the sqlite3_txn_state() documentation.
drh [Thu, 10 Sep 2020 15:09:11 +0000 (15:09 +0000)] 
Try again to fix the typo in the sqlite3_txn_state() documentation.

FossilOrigin-Name: 6d1ab0403c2855b595f5d294305f41f56a7a93503f2a58d1b1d12431d480704e

4 years agoFix typo in the documentation for the new sqlite3_txn_state() interface.
drh [Thu, 10 Sep 2020 14:54:57 +0000 (14:54 +0000)] 
Fix typo in the documentation for the new sqlite3_txn_state() interface.

FossilOrigin-Name: 23f7d01758cbcf22bd34e78fb8284c7af18f3059a03c4ff6ab3e556ca11fce19

4 years agoIf an amalgamation is created using SQLITE_ENABLE_UPDATE_DELETE_LIMIT,
drh [Thu, 10 Sep 2020 12:41:46 +0000 (12:41 +0000)] 
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

4 years agoFix another (harmless in practice) tsan error in shared-cache mode.
dan [Mon, 7 Sep 2020 11:14:27 +0000 (11:14 +0000)] 
Fix another (harmless in practice) tsan error in shared-cache mode.

FossilOrigin-Name: 5a74fa3f0a64f462c8add9beae231a9bbdd19e54d07b54f08726cb1411fc8d3a

4 years agoRemove an artifical limitation on the length of columns in the "box"
drh [Sun, 6 Sep 2020 17:40:38 +0000 (17:40 +0000)] 
Remove an artifical limitation on the length of columns in the "box"
output mode of the command-line shell.

FossilOrigin-Name: 783fa887c9ed1a7d72c310df1dd9de91c016061b05fdeec87fbb2a7eb0b952ea

4 years agoFix a bug in Fossil that might cause it to crash if there is
drh [Sat, 5 Sep 2020 06:21:54 +0000 (06:21 +0000)] 
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

4 years agoFix a tsan error that could occur when using shared-cache mode.
dan [Fri, 4 Sep 2020 19:10:43 +0000 (19:10 +0000)] 
Fix a tsan error that could occur when using shared-cache mode.

FossilOrigin-Name: de80bc87300257cc49d98e2d22e914211f213dce912f320c8b37b3883c73923c

4 years agoEnsure that the busy-handler count is reset at the end of each sqlite3_file_control...
dan [Fri, 4 Sep 2020 17:30:59 +0000 (17:30 +0000)] 
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

4 years agoFix harmless compiler warning.
mistachkin [Tue, 1 Sep 2020 19:02:52 +0000 (19:02 +0000)] 
Fix harmless compiler warning.

FossilOrigin-Name: a711e8cd2c7b64e06241736ecef478ac64ddbe7b58e0933b6febba63f7fb06e1

4 years agoIn the Lemon output, add a prefix comment that explains that the output file
drh [Tue, 1 Sep 2020 12:26:55 +0000 (12:26 +0000)] 
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

4 years agoLemon updates: (1) include the #defines for all tokens in the generated C
drh [Tue, 1 Sep 2020 11:20:03 +0000 (11:20 +0000)] 
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

4 years agoImprovements to the IN-early-out optimization so that it works more
drh [Tue, 1 Sep 2020 01:52:03 +0000 (01:52 +0000)] 
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

4 years agoFix a harmless compiler warning.
drh [Tue, 1 Sep 2020 00:26:21 +0000 (00:26 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: 3ca0b7d54d73d07cd6b32e650a809174bb1cd66ce5ecdb36f65b70899ea05824

4 years agoNew test-control that returns the number of calls to
drh [Mon, 31 Aug 2020 18:49:04 +0000 (18:49 +0000)] 
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

4 years agoFix the documentation for the OP_IdxGT family of opcodes to show that the
drh [Mon, 31 Aug 2020 12:29:03 +0000 (12:29 +0000)] 
Fix the documentation for the OP_IdxGT family of opcodes to show that the
P5 operand is not used.

FossilOrigin-Name: 62f7d2a61259f296ffdcb3b3ee1a13925c4563ac8ed669f8a8a63fc7bc3a0a37

4 years agoFix a sanitizer warning in zipfile.c.
dan [Sat, 29 Aug 2020 19:00:19 +0000 (19:00 +0000)] 
Fix a sanitizer warning in zipfile.c.

FossilOrigin-Name: ded1a75b3cf39834d38a385f38ae969b296f6c9409856b7eea08645e861b1ac2

4 years agoImprove performance of wal-mode locking on unix in cases where there are hundreds...
dan [Sat, 29 Aug 2020 15:15:07 +0000 (15:15 +0000)] 
Improve performance of wal-mode locking on unix in cases where there are hundreds of connections to a single database within the same process.

FossilOrigin-Name: a1c19eea8f141b89a0921da0724096feb21a772ef6654f164e2c36ebf9f7871e

4 years agoFix handling of an xShmLock(SHARED, UNLOCK) call when the caller does not hold any... unixshmlock-opt
dan [Fri, 28 Aug 2020 20:01:06 +0000 (20:01 +0000)] 
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

4 years agoModify the unixShmLock() function to avoid iterating through the (possibly large...
dan [Fri, 28 Aug 2020 19:27:15 +0000 (19:27 +0000)] 
Modify the unixShmLock() function to avoid iterating through the (possibly large) set of connections to the same database file.

FossilOrigin-Name: e0faddf0dfc3a40b6b94408296dd781dd0264ecc9f2129ce4405438433fb00e0

4 years agoAdd the miscellaneous 'series' extension to the shell.
mistachkin [Fri, 28 Aug 2020 18:47:39 +0000 (18:47 +0000)] 
Add the miscellaneous 'series' extension to the shell.

FossilOrigin-Name: fc0856dccfab273d50457052fa3c6da768d0eb2504ad04d9540da4e3222fc829

4 years agoUpdate Lemon documentation. Patches from sgbeal.
drh [Fri, 28 Aug 2020 13:10:00 +0000 (13:10 +0000)] 
Update Lemon documentation.  Patches from sgbeal.

FossilOrigin-Name: f5dc83442bf010bc4083e083b3a1acbb9918b7e685ca676dd899a0e09df196bc

4 years agoFix a couple of unreachable branches.
drh [Fri, 28 Aug 2020 12:58:21 +0000 (12:58 +0000)] 
Fix a couple of unreachable branches.

FossilOrigin-Name: f2d26f2b11317abd4f993faa1a4df7afcd1a2d4e448ecc69ca05e9ebf102cd62

4 years agoAdd fts5 test to confirm that for a table with columns a, b, c and d, "{a b}" and...
dan [Fri, 28 Aug 2020 11:19:49 +0000 (11:19 +0000)] 
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

4 years agoRemove a (harmless) redundant variable from the CLI implementation.
drh [Thu, 27 Aug 2020 20:55:54 +0000 (20:55 +0000)] 
Remove a (harmless) redundant variable from the CLI implementation.

FossilOrigin-Name: 3f7bbb840de0a9b1ca89288805cb151aea6fcb82efda9ba39f51abf1b17c070b

4 years agoInclude the original text of the CHECK constraint in the error message for
drh [Thu, 27 Aug 2020 18:36:30 +0000 (18:36 +0000)] 
Include the original text of the CHECK constraint in the error message for
anonymous CHECK constraints.

FossilOrigin-Name: 5ce34a955bb36d77edc9951cb7ac2ef9c876d7d3ff5852af682f558e248f428c

4 years agoApple the same fix for ticket [9eda2697f5cc1aba] to text-to-integer
drh [Thu, 27 Aug 2020 16:28:30 +0000 (16:28 +0000)] 
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

4 years agoDo not attempt to run test script analyze3.test as part of the "prepare" permutation.
dan [Thu, 27 Aug 2020 14:53:47 +0000 (14:53 +0000)] 
Do not attempt to run test script analyze3.test as part of the "prepare" permutation.

FossilOrigin-Name: f7f13cb1bc699c034a3f5f7a2431c8055cb79e2a14d5e70e1fc5dd6dec00fb26