Commit Graph

23627 Commits

Author SHA1 Message Date
mistachkin
3c64888253 Add the '-guard:cf' compiler option for Windows 10, per [forum:/forumpost/8d3b4ad694|forum post 8d3b4ad694].
FossilOrigin-Name: 2d6a16caa7d28ad5c766036b2eb6c2020683fcc9389b3c7df2013739929dd36f
2022-01-06 17:13:56 +00:00
drh
9dbf96bd70 An attempt to integrate the JSON functions directly into the SQLite core,
rather than holding them as an extension.

FossilOrigin-Name: 583b47d865fb8d2c9ae4d3a4e70356a8a758978efb0a282f6b19775bf41fb748
2022-01-06 01:40:09 +00:00
drh
10f7365748 Remove two NEVER() macros that can sometimes be true if the database is
corrupt.  dbsqlfuzz 0414d2c18290fc80fd5fb540def7d3e46c1ae9c6.

FossilOrigin-Name: b6a82f3c3b9d89fdf628c7f117b6a4a64383a36c84fe84d47c80e845c9bd8a4f
2022-01-05 21:01:26 +00:00
dan
c6977c1c0d Fix an assert() failure that could follow an OOM when coding a RETURNING trigger. dbsqlfuzz case 5d3e2438f15dc32b473d9f29413157857efa1212.
FossilOrigin-Name: 7ae596dd4a73a09585c5dc9f4faf75d126d0733fc2fb32c1de64126a1088d967
2022-01-05 15:54:02 +00:00
drh
ebc4434e99 Improved handling of OOM errors in sqlite3ExpandReturning().
dbsqlfuzz 1040b720f0bbc3bdcfe7336acffbf71517e3ef82.

FossilOrigin-Name: 33c6b8e94bda12df13b4d2dd782b3120c3628596b86ef531d20b3100bf159b50
2022-01-05 11:49:58 +00:00
larrybr
d0a9a46215 Test .mode quote blob output
FossilOrigin-Name: ef4dcd1080241a62a50eff28ef12c49da0116032f10843aaf048ae7ad3cdfd0e
2022-01-03 19:33:44 +00:00
drh
b248668bc9 Small performance and size optimization to allocateCursor().
FossilOrigin-Name: 23f042669aff535afa6ee9de367656848d01e90a1c9dab9359fa938a615b4195
2022-01-03 01:43:28 +00:00
drh
80d99e19b6 Remove unnecessary assignment operations in the btree search algorithm,
for a small size reduction and performance increase.

FossilOrigin-Name: 01bd266eb682feed901a0995c2232b62d8444d19dbb227095dfbfe8edeaa5d88
2022-01-02 21:53:54 +00:00
drh
5d1bf4f560 In the CLI, fix ".mode quote" output for UTF16 BLOBs.
[forum:/forumpost/b4bfe62fe6|Forum post b4bfe62fe6].

FossilOrigin-Name: 728e9dcc6d211acd787837c41cb62275284b5e02f55bd28bf5a44e233bcb057a
2022-01-02 20:54:33 +00:00
drh
bda4d20080 Do not open a rollback journal file when the journal_mode is OFF, even if
such a file exists on disk. See
[forum/forumpost/ec2a102440|forum post ec2a102440] for a description.  I so
far have been unable to find any harm to come of the problem, other than the
assertion fault when in DEBUG mode.

FossilOrigin-Name: fdf9ed665b2fb07d26f3852bfd2170f2fb56851edd2851d47672116a8ea58463
2022-01-02 19:32:43 +00:00
drh
d0fa3484c6 Improve formatting of an assert(). No functional changes.
FossilOrigin-Name: 4bb78ce8b50af3c6f04ffdf4de4438e61370a73ccfa971479af5d58a0a7e5fbb
2022-01-02 19:10:49 +00:00
drh
29bbc2b51f Performance optimization in btreeParseCellPtr() by unrolling the loop that
decodes the rowid.

FossilOrigin-Name: fef72368a2eef5cb68ffc56e4f01be212d5e3318ebdb56a23ab26e1ef454272e
2022-01-02 16:48:00 +00:00
drh
7e17a3abbe Small performance optimization and size reduction in sqlite3BtreeDelete().
FossilOrigin-Name: da0af4dd9ba4180a16543fac1549fd4ccecdc66dcf6d275f77de21fd80708882
2022-01-02 14:55:43 +00:00
drh
44a5c0257f Clear the cache of triggers used to implement CASCADE foreign key constraints
whenever the schema changes.  Fix for the problem identified by
[forum:/forumpost/2831335356|forum post 2831335356].

FossilOrigin-Name: 5232c9777fe4fb13e1ecfe5b5d644e2c45d0514f95884dbed49a03fb9b67304c
2022-01-02 12:01:03 +00:00
drh
2dfe9664a9 Earlier detection of corruption in sqlite3BtreeDelete(). Fix for
the assertion fault reported by
[forum:/forumpost/9d78389221|forum post 9d78389221].

FossilOrigin-Name: 13e9ff9e84a114374b49986484dbee05953a496f3017dd5089fba6f495a17c40
2022-01-02 11:25:51 +00:00
drh
24a82eadb3 Do not raise an SQLITE_SCHEMA error if in sqlite3Init(). Fix for PoC #2 in
[forum:/forumpost/b03d86f951|forum post b03d86f951].  See TH3 for test
cases.

FossilOrigin-Name: e199a851e316bd471bfc54204b8c250d3ae93b829261214158a2c74acad4093e
2022-01-01 22:55:31 +00:00
dan
4ce289d088 Fix an assert() in pager.c to avoid the possibility of side-effects.
FossilOrigin-Name: 1d1fe03c752267f03f015ada975876f65e2a7b967e19f057b5c73f95d7df8a9c
2022-01-01 20:02:58 +00:00
drh
a6ca90c38c Attempt to fix a harmless compiler warning in FTS5.
FossilOrigin-Name: 8e619c21e2326be1538b60908e7cd211558ec840835c6eb69e768eb190e1fd0b
2022-01-01 19:55:29 +00:00
dan
0f42f71da2 Fix an obscure problem with releasing savepoints stored in an in-memory journal that could cause subsequent savepoint rollback to fail.
FossilOrigin-Name: 73c2b50211d3ae26aeb89976ec7b9fcd7de9f152b283ec7d0809ad18bddc603e
2022-01-01 19:29:50 +00:00
drh
3ea82384ea Remove an obsolete assert() statement that no longer does anything useful
and which is not always true.  Fix for PoC #1 of
[forum:/forumpost/b03d86f951|forum post b03d86f951].

FossilOrigin-Name: c76a4c0b3cb625017ba09c8bccfcf1b5826df6873f1d3705d3345716079d5ec9
2022-01-01 17:21:55 +00:00
drh
3907560848 Fix a faulty assert() statement - adding a CORRUPT_DB term - based on a test
case derived from [562805cf488a455c].  Also add a test case to that prior
issue.

FossilOrigin-Name: 0dd6b5fccd554ebe4c0b081601863acd7b6ea81b51e14b508b23244f2a570e7e
2022-01-01 12:26:01 +00:00
drh
017e363787 Mark the REGEXP operator in the built-in extension as deterministic.
FossilOrigin-Name: e654b57a9fc32021453eed48d1c1bba65c833fb1aac3946567968c877e4cbd10
2021-12-31 22:53:15 +00:00
drh
54bc63815a Simplify the sqlite3RunParser() routine by omitting the third parameter.
Results in a binary that is about 100 bytes smaller and 1.4M cycles faster.

FossilOrigin-Name: 6fb2a1bb0280d6e31291e3fd06bbcbbb28ef5fb27d3898e2327a50ac738ae1f3
2021-12-31 19:20:42 +00:00
mistachkin
c158c07a22 Fix harmless compiler warnings in the shell.
FossilOrigin-Name: f3ea36d79b6aa95470bf13e8d4ed5250a6b19bc16032b29e4dcdfc49b47a1edf
2021-12-31 19:08:20 +00:00
mistachkin
2b5fbb2836 Fix harmless compiler warnings seen with MSVC.
FossilOrigin-Name: a9bfb621091b6d92d1caeb69134d3809d9e0b43fe764608c5995db277ac785be
2021-12-31 18:26:50 +00:00
drh
16118265ca Performance optimization and size reduction in sqlite3RunParser().
FossilOrigin-Name: 41ee2bac5731d8434322e92abba580f7c759a137e576dd286fe01ab23fc440ea
2021-12-31 17:54:48 +00:00
drh
b296ab6f6a Move the pTriggerPrg and pCleanup elements of the Parse object up into the
section of that object that is persisted across calls to sqlite3NestedParse().
This fixes a memory leak
[forum:/info/24bd1fef7e9323ef|reported in forum post 24bd1fef7e9323ef].

FossilOrigin-Name: 562805cf488a455cdc57adcb110fef9b5416d813d5eaeabacd28bccb76d7f39d
2021-12-31 16:37:46 +00:00
drh
9aff824090 Remove unnecessary conditionals around the ORDER BY resolver calls in
multiSelectOrderBy().

FossilOrigin-Name: f2887e018be71bc406526935c7e99e42f12fc5d1d1c65a89dc2b9bfbca01d43d
2021-12-30 17:46:15 +00:00
drh
e1961c55c3 When constructing the sqlite3_index_info object for the xBestIndex method
of a virtual table, omit constant trims from the ORDER BY clause, as they
will always be in the correct order.

FossilOrigin-Name: 524c2b87d74c8cad6fb377aed7275788d61beafe61e675480de732519987102c
2021-12-30 17:36:54 +00:00
drh
66306d86ab When a table has an INTEGER PRIMARY KEY ON CONFLICT REPLACE and some other
uniqueness constraint, and it participates in an upsert on that other
constraint, ensure that code that checks for conflicts on the INTEGER PRIMARY
KEY is well-formed.  Fix for the problem reported by
[forum:/forumpost/06b16b8b29f8c8c3|forum post 06b16b8b29f8c8c3].

FossilOrigin-Name: 2f09b51b1ff37bf98f958564cc1224968caa7e33147e6666b5c1ba20b2a7813b
2021-12-30 02:38:43 +00:00
drh
38cebe07bb When implementing a multi-way compound SELECT using merge, try to balance
the merge tree.

FossilOrigin-Name: bb8522fe0dc54282ec13672eba9b44ee08f9cb55c1663f1699a61bf96ec1fd04
2021-12-30 00:37:11 +00:00
drh
092ba22cca Minor changes to shell1.test test results to account for the new feature
of the shell that points to the specific part of the input line where the
error occurs.

FossilOrigin-Name: d4870c08893ea9984b1fa1c3a7d04893ad5ed4a2130e9287d169a306cc8ef0a4
2021-12-29 13:32:36 +00:00
drh
41584df573 Ensure that the affinity of columns is honored in the RETURNING clause.
See [forum:/forumpost/e0c7574ab2|forum post e0c7574ab2] for the bug report.

FossilOrigin-Name: 4711fb69547f4f17653ab116030c32fdcc2c836410349d1d025866ffc15704da
2021-12-29 04:31:54 +00:00
drh
9ebe43c120 Add the sqlite3_error_offset() interface. Use it to enhance error reporting
in the CLI.

FossilOrigin-Name: 416602a85101c2cd1705eb5306a8933e54cb05ae1562400395ec2769173dec01
2021-12-29 04:13:37 +00:00
drh
44c44cd7c5 Make .read's help tell of piped input
FossilOrigin-Name: 155c3e9c7ccd6fd644cc64b027cf460112c491e5f9202dd76cefe2000936ad80
2021-12-29 04:10:49 +00:00
drh
412a59f56e Change an assert() in FTS3 into assert_fts3_nc(), since it is a harmless
condition that can occur when processing a corrupt database file.

FossilOrigin-Name: e773d6219bded9a5dfa9930882682dadaa7f1c6be344dbde904c9477a89f2d2c
2021-12-29 04:10:03 +00:00
drh
9169d0cb0f Fix the build-breaker bug in test1.c introduced by check-in [7fa20ca4c09ab024].
FossilOrigin-Name: 5f804da1820c98e7ff5c377e57e30b5154844b92ce622ed2ff888fe2c887e1ca
2021-12-29 04:08:11 +00:00
larrybr
a2ba25b508 Make .read's help tell of piped input
FossilOrigin-Name: e4ddcd8aa582c1130c34e9f05cd3e5f96ebf03c97a36c09ca442e3612fee4a20
2021-12-28 05:08:38 +00:00
drh
d66d5c2d35 Change an assert() in FTS3 into assert_fts3_nc(), since it is a harmless
condition that can occur when processing a corrupt database file.

FossilOrigin-Name: c03205aee9015fd886b8db02c8190899cee699255ca370f939e547deaf5ba9e8
2021-12-25 23:59:54 +00:00
drh
a98c868a10 Add the sqlite3_error_offset() interface. Use it to enhance error reporting
in the CLI.

FossilOrigin-Name: 7fa20ca4c09ab0249de0363691541fa836120ec277e72feb0e1516b9bfbdd97a
2021-12-25 00:26:51 +00:00
drh
5cec7e1a5f One minor change for an exceptional case in sqlite3_error_offset().
FossilOrigin-Name: c93609a8b9dc2e656bb4360138606e269fd323469f7666dbc3bbc699e431313e
2021-12-25 00:19:46 +00:00
drh
f62641e91c Add the sqlite3_error_offset() interface. Use it in the CLI to provide
better context for error messages.

FossilOrigin-Name: b518ce77439852759bc0901071f36d622b1314c9bf3d29c279dfcc405188b975
2021-12-24 20:22:13 +00:00
drh
c320e062a3 Fix a minor problem in the CLI introduced by [d156123885abe6bf], apparently.
FossilOrigin-Name: 37e6e10f4364f556c7503c80408fc62895cdccdd0372fb2b63aaca02c3a1ee30
2021-12-24 19:44:11 +00:00
drh
ceeb04bf90 Raise an error if a schema name is attached to the table-alias name of a
subquery or view.  See
[forum:/forumpost/021a33600b|forum post 021a33600b] for the bug report.

FossilOrigin-Name: 8af8c153f8c3fe16db1c2280571e005838c4ea3c48929ad7660a1686e49ed255
2021-12-24 13:30:22 +00:00
drh
b131bf7039 Reduce the size of the compiled binary by a couple of hundred bytes by
using a thigher packing of a transformation table in date.c.
Suggested by [forum:/forumpost/4f6efbb2a9|forum post 4f6efbb2a9].

FossilOrigin-Name: c75ba4fa644d338d22813c17172b9975411fe6197e07fd584e3209e3beb78036
2021-12-23 00:16:06 +00:00
drh
8b6dfc474b Update the README.md to instruct the user to remove the final comment line
from the "manifest" file before using it to compute the check-in hash.

FossilOrigin-Name: 7b4f9d95a95f685ea4ee045e43c67b1a5c70e908e357b0b41d522699255663ce
2021-12-21 16:59:45 +00:00
drh
f3c33c6235 In the json1 extension, which compiling it separately, ensure that either
SQLITE_DEBUG macro or the NDEBUG macro is set prior to including assert.h.
If neither macro is defined, then assert() statement do generate code but
VVA() statements do not, and that is a deadly combination.
[forum:/forumpost/858dee399e|forum post 858dee399e]

FossilOrigin-Name: d9f814a6402ca7fd999bbb847dc354b52ab9b97cae0c932344584d26c9430f24
2021-12-20 23:46:44 +00:00
dan
62e9c352eb Remove old script ext/fts3/mkfts3amal.tcl, as it doesn't work.
FossilOrigin-Name: 9e33ee24b3793b3d7faf7421279d16217f8b09b1e92bfdc771f902f2f1e1b7d6
2021-12-20 17:00:42 +00:00
drh
b6592f6563 Improved documentation for the sqlite3_vtab_collation() interface.
FossilOrigin-Name: 826f84a92d3b1f760560bff72c911a2c664737820af0c9114eb3494df7b8e878
2021-12-17 23:56:43 +00:00
drh
6e627c44de Fix windowC tests to specify little-endian or big-endian UTF16, for
cross-platform portability.
[forum post 559b84a5c6|forum:/forumpost/559b84a5c6]

FossilOrigin-Name: adf3a1e6f7575964e467f6813ff980e802cf5a37aaa9e1736af702c493f276b1
2021-12-16 19:50:02 +00:00
drh
a91734894e Give the correct prefix to tests in the windowC.test module.
FossilOrigin-Name: fb43456324c26879767b08febf1b5a2b46a289f25398a3872f81d845afd5d84e
2021-12-16 19:43:16 +00:00
drh
fe46317e26 In the CLI, omit the ".oom" command (only available in debug builds) and
disable the experimental ".expert" commmand in --safe mode.

FossilOrigin-Name: 5cda1f7da885afdfda8683c59e78fec8da1a05c7a4fde573e89db5f872fcfb20
2021-12-16 17:57:21 +00:00
drh
621a5e0c47 New defenses against OOM and corrupt database problems in the CLI.
FossilOrigin-Name: 5c9fd7fde16d8e335488b8bf5c691961d2636201b034d1f29d25de8708de291d
2021-12-16 17:35:27 +00:00
drh
aca5e49caa Fix a typo in the result of one of the new test cases.
FossilOrigin-Name: 4d02a129c4781c97981748f3c69564e1320d8085dfba4c207e54793390cd64ab
2021-12-16 17:21:34 +00:00
dan
2999068d2c Fix fts3 and fts4 so that they can still be used even if the other is dropped by a call to sqlite3_drop_modules().
FossilOrigin-Name: a0a8d6c9f0e91996003626e4f80dfac278e3c5bddd9ace5d442061e6c95e49dc
2021-12-16 15:29:49 +00:00
drh
61fd4b9c3d Fix a memory leak in the CLI that occurs after an error in the ".open" command.
FossilOrigin-Name: d156123885abe6bf23c3530de99be257f82ef85b89fbe019568ac60fa1ed5bb7
2021-12-16 14:59:25 +00:00
drh
b71a485386 Fix harmless compiler warning in the new Bloom filter logic.
FossilOrigin-Name: 9406d95d3fbaf0d8e65623adb790845f78a7456fb32aafd7fa4f74eda2f2dacc
2021-12-16 14:36:36 +00:00
drh
e0adf60241 Improved robustness against OOM in the expert extension.
FossilOrigin-Name: e732c429bafeffaf7e0f458213089c073c262a39eabb41b291e5006078ca7f98
2021-12-16 14:26:16 +00:00
drh
511b118dd2 Fix a potential NULL pointer dereference in the CLI logic for printing the
schema of virtual tables.

FossilOrigin-Name: fe44ebf6be47e1c7f2458297669dbd2b882a31595ea8759f7e8bb024ffc44d11
2021-12-16 13:56:04 +00:00
drh
e3e2565daa Add more tests for OOM conditions in the CLI.
FossilOrigin-Name: b6fa402d159b2475a7b99ef6a5180d7bf800f90afe28cea726d346d071405045
2021-12-16 13:29:28 +00:00
drh
8a95d3d433 Simplify the generation of the sqlite3_index_info object during query planning
for virtual tables.

FossilOrigin-Name: 241dc0428a6e0238c57e2449e98ea60047e777e29c83a4ebe6da16f7cba40e19
2021-12-15 20:48:15 +00:00
drh
52576b78f6 Enhance the virtual table query planner so that it is able to deal with
ORDER BY terms that contain COLLATE clauses as long as the specified
collation matches the virtual table.  This is especially important for
UNION ALL since a "COLLATE binary" is added to ORDER BY clauses if no
COLLATE clause exists in the original SQL.

FossilOrigin-Name: 5c3d398d20b86a1558720e995eddf11403aec2d160590571fa9525fe8f6efff9
2021-12-14 20:13:28 +00:00
drh
22f018c938 Minor fix to the ORDER BY elimination logic in generate_series().
FossilOrigin-Name: a2e50712fca9dff1b8d19631f792270c82da3c8696a5d9890cf0d1e13e950d60
2021-12-14 18:11:46 +00:00
drh
06164b2340 Omit the return value from sqlite3VdbeSerialGet() for a size reduction
and performance improvement.

FossilOrigin-Name: 788e79f881d443fc1b3a213a7ba4f19bfd245e96c15bb21fcb6bffd92c4320b8
2021-12-14 00:36:09 +00:00
drh
7f8f659260 Small performance optimization and code size reduction in moveToRoot().
FossilOrigin-Name: cdcde00b2d68eeb35c472fdfd4c4508551f6722054394b43cc97eaf01ad7181d
2021-12-13 19:59:55 +00:00
drh
4f2006ddec Add NEVER() on an unreachable branch in the Bloom filter pull-down logic.
FossilOrigin-Name: 471070462593faba865d8d05ee89161b340145351e2fa0bfbaa766d974e932d6
2021-12-13 18:53:10 +00:00
drh
c5860af006 Fix an off-by-one error in the Bloom filter pulldown logic, found by OSSFuzz.
Also fix over-length source code lines in the immediate vicinity.

FossilOrigin-Name: 027626521c02be06ef61e8229bde49d20cb3f1cb600c4cb127c5f139b9de8858
2021-12-13 18:43:46 +00:00
drh
089a9ff48a Remove unused code.
FossilOrigin-Name: b98b24f26518fb362e776bbaef80910bed66b654239e7c76d4b234033ef4174b
2021-12-13 00:02:59 +00:00
drh
dc56dc93a5 Do not allow early evaluation of Bloom filters that use the IN operator as
the machinery to deal with the IN operator is not available.
dbsqlfuzz 5b51c247518278f79a45cea978702e86e86cd4f9.

FossilOrigin-Name: 799db7cb2e0d73031182d26a0e5919368f9f9823df81cb2863bfe79eca344f5c
2021-12-11 17:10:58 +00:00
drh
ef95d5583b Factor out the logic that does quoting for the SQL quote() function, so that
it might be reused for other purposes.

FossilOrigin-Name: 8e98ba1eeb1a5a61b7cb2de337ef8bca3d07494266a50d62b9c6bc60ad0a955f
2021-12-10 21:01:24 +00:00
drh
27a9e1f615 Rename the internal routine constructBloomFilter() to
sqlite3ConstructBloomFilter(). OSSFuzz is reporting a crash with a garbled
stack that we cannot reproduce. Perhaps the original "constructBloomFilter()"
name is colliding with some internal name used by OSSFuzz. We'll see if this
rename clears the problem.

FossilOrigin-Name: 403e7312dd9a3fe493a21aceb82e387d6f152622d66c1b403c881597713e8cc3
2021-12-10 17:36:16 +00:00
drh
b574acb94f Add support for Bloom-filters as a performance optimization for joins.
FossilOrigin-Name: 633bfeeea2bccdd44126acf3f61ecca163c9d933bdc787a2c18a697dc9406882
2021-12-09 20:06:18 +00:00
drh
5a4ac1cc30 Remove unused code and fix comments. Final cleanup before merging.
FossilOrigin-Name: ce42039f5647b1f276acf5d9911528ecb47df1544a587def72c8cd6b2f664289
2021-12-09 19:42:52 +00:00
drh
a11c5e22b5 Enable bloom filters for the right table of a LEFT JOIN. Fix unreachable
branches.

FossilOrigin-Name: d342ab722de1fc3f34219c9755253db9d88eb50a6fa5cc257207008b00e7fc03
2021-12-09 18:44:03 +00:00
drh
59285ed788 Add ".mode off" and ".mode count" to the CLI.
FossilOrigin-Name: 1eefd957ff35e961685db565f7ef116c566a04574c5bedad7298b3cc69dd72d2
2021-12-09 16:26:45 +00:00
drh
5d88be8f48 Add ".mode off" and ".mode count" to the CLI.
FossilOrigin-Name: b11f4d080aa9e6f694e2ec401e871f42bf25997e8e8bf77fa9b6014a50466e3c
2021-12-09 16:17:43 +00:00
drh
92704681a1 New test cases added to test/fuzzdata8.db
FossilOrigin-Name: 7046877006259a0073cca4ddb4541321d373c462eac9924be26b5ae224075732
2021-12-09 14:15:39 +00:00
drh
15561b916d Do not attempt to reprepare a prepared statement that returns SQLITE_SCHEMA
if there was an OOM.  This enhancement supercedes check-in
[fee469925231d074].

FossilOrigin-Name: 94fdbeffaf501daf30dc7fae7cef5c2bfdb3a9b055562adfc04374a9fc899c8d
2021-12-09 14:09:47 +00:00
drh
7e910f6422 Add SQLITE_TESTCTRL_LOGEST and enhance the LogEst utility program.
Improvements to testability of bloom filters.

FossilOrigin-Name: 88b43d798cc5aa59855e92d3e658aee9f0a5def6ffbc5db77af048d75ecdf8cc
2021-12-09 01:28:15 +00:00
larrybr
969c46486c Clarity tweak for date.c
FossilOrigin-Name: db58b2def014bdb146751110488a088767530ca2557baf73d6181a2558bbe6d3
2021-12-08 20:36:08 +00:00
drh
fb82caf0be Improvements on the decision of whether or not to use a Bloom filter.
FossilOrigin-Name: 0fb2a4e08f518cb38ea3edc6a084d1e4874fd622ba3cf9101b49b3e7dc1a3f2b
2021-12-08 19:50:45 +00:00
drh
46658d7f9a Enhance the sqlite3SrcListAppendFromTerm() routine so that it sets the
Parser error on an OOM, causing an earlier unwind of the stack.

FossilOrigin-Name: fee469925231d074c17b948605143cfbb2e9595851a797995e7331f1ab2a61ca
2021-12-08 18:50:30 +00:00
drh
c491a25631 Merge the WhereClause fix from trunk
FossilOrigin-Name: d3250256772e3348abe887c0ca3550a6647cce3804c9456a9d0112aea7ee1c46
2021-12-08 16:15:41 +00:00
drh
132f96fc75 In the WhereClause object, do not assume that all TERM_VIRTUAL terms appear
at the end of the list, because that is no longer true.  Instead, keep a
separate nBase count that is the size of the list excluding the tail of
virtual terms.  Use nBase instead of nTerm when scanning terms that are not
virtual.  Add assert()s to validate correctness of WhereClause.

FossilOrigin-Name: 6024682ca467fa4fe49608772b0bbfa2f8a419b32cebfa715941073c8b29da49
2021-12-08 16:07:22 +00:00
drh
761d64b73b Do not generate a Bloom filter if it cannot be used prior to the next seek,
as that leads to a misleading EXPLAIN QUERY PLAN.

FossilOrigin-Name: 2739ed5192058fbcc816ecbc252be687efc606e038bfcd6cf71194a3f4f5684e
2021-12-07 22:37:50 +00:00
drh
3bd7cd736d Improved EXPLAIN QUERY PLAN output for Bloom filters.
FossilOrigin-Name: 00070e1fff6aec3d7c7b121f2b02bbca38a1664aca9afc3fb7e293f07fd1704f
2021-12-06 23:07:59 +00:00
drh
23d41e63f2 Add SQLITE_STMTSTATUS_FILTER_HIT and _MISS for tracking the effectiveness
of Bloom filters.

FossilOrigin-Name: 24ba535d200fc8a99dd8e66c6d100b5f6ae442098bafb152008429398eefe3e7
2021-12-06 21:45:31 +00:00
drh
50fb7e09b4 Omit the OP_FilterInit opcode. Use OP_Blob to initialize each Bloom filter
instead.  Size the Bloom filter based on sqlite_stat1 size estimates rather
than a run-time measurement for improved testability.

FossilOrigin-Name: 8a9036ee617a6ad93bfe827b0789773c49d3d45b085cb76fa4b9b20a41b79b97
2021-12-06 20:16:53 +00:00
drh
8c1c3e5e37 Merge trunk fixes into the bloom-filter branch.
FossilOrigin-Name: edacf8034dc6bd892038c220c480ea512dbb4005db2a6b1f8e679e8a4929c6ed
2021-12-06 19:11:31 +00:00
dan
c436b3056d Fix an OOB read that could occur in fts5 when processing corrupt records.
FossilOrigin-Name: bb9b1a15f7e80483162049dfd981d059dc69d03348b521f7ac164a8cd3ae3cc4
2021-12-06 18:57:02 +00:00
drh
f6a4ef144e Do not allow SQLITE_LIMIT_LENGTH to be set lower than 1 as an
SQLITE_LIMIT_LENGTH of 0 causes lots of unnecessary problems for
users of the sqlite3_str object.

FossilOrigin-Name: 8fd5b8ec4ab9b5554d27f25a4638d56e347eab78b60900f24b15a815d3731330
2021-12-06 15:40:24 +00:00
drh
38ed1ceb5a Do not allow certain dangerous ".testctrl" commands in safe mode.
FossilOrigin-Name: 080e72d119b836c49916201bf135445aa7d53cefe40a47437a93448c4d0f41cd
2021-12-06 15:24:36 +00:00
drh
39addd0a3f Fix SQLITE_TESTCTRL_IMPOSTER so that it is a harmless no-op if the schema
parameter is invalid.

FossilOrigin-Name: 2d9a45ab10aaad681e11d639195430c0988b6ca1b96db6bf0b31b889e88a5430
2021-12-06 15:08:30 +00:00
drh
5baaf40af1 Attempt to vary the size of Bloom filters based on an estimate of how many
keys the filter will hold.

FossilOrigin-Name: a7adcf69088cba4b86cc5731a45c9a5263af4355bc0a38f5225cab421c915f7f
2021-12-06 13:07:28 +00:00
drh
6ae49e67cc Run as many Bloom filters as possible before index lookups.
FossilOrigin-Name: 06f6fefd67086896bc49272c6319545ff6c6792f18babe23aced27b60b032119
2021-12-05 20:19:47 +00:00
drh
35685d3e5e Try to run all Bloom filters before any Seeks. This gives a small performance
gain on the Star-Schema Benchmark.

FossilOrigin-Name: 5be2470f8755ef454f813c880e659bdbf82f2396be9320cf3079cd4ca8e81a19
2021-12-05 00:45:55 +00:00
drh
fecbf0a179 Miscellaneous cleanup of the new Bloom-filter code.
FossilOrigin-Name: 201b6dd875b0ae2bbc9969b098e88abfc09e37b59e857decd41f2dcbeeb13e01
2021-12-04 21:11:18 +00:00
drh
067c60cfc9 Add VdbeCoverage() macros. Adjust the Bloom-filter hash function so that it
correctly deals with zero-blobs.

FossilOrigin-Name: 629ee2e3e3125bfd2af435c6713d49e46691213ad15db0a5e93a63a77f1130c2
2021-12-04 18:45:08 +00:00
drh
770dade262 Apply the Bloom filter only on those terms of an index that have equality
constraints.

FossilOrigin-Name: a70429596a3c6a413b03118b0d800521b3526d99dcf88a48acc3189b51518d82
2021-12-04 14:24:30 +00:00
drh
19ce9aafdb Add the "WITH BLOOM FILTER" clause to the EXPLAIN QUERY PLAN output for
cases were a Bloom filter is used.

FossilOrigin-Name: 8e078c0e404fe4b3661dd4a11a992a8914c99e2a144cecc417421cbd68fa08cc
2021-12-04 13:52:08 +00:00