]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
2 years agoAnother approach at attempting to contain the damage caused by corruption corruption-in-btree-init
drh [Thu, 16 Mar 2023 02:30:43 +0000 (02:30 +0000)] 
Another approach at attempting to contain the damage caused by corruption
that leaves MemPage.isInit clear.  Works better than the previous but is
still not perfect.

FossilOrigin-Name: ba964eb0f3dac957367bc03cb3800800e8f2758403467bdbfb44e7e1a7d9cebf

2 years agoWhen the btreeInitPage() routine detects database corruption, it should
drh [Thu, 16 Mar 2023 01:20:03 +0000 (01:20 +0000)] 
When the btreeInitPage() routine detects database corruption, it should
continue to the end and set MemPage.isInit before it returns SQLITE_CORRUPT,
because if it leaves MemPage.isInit unset, then can cause difficulty later.
dbsqlfuzz 460aa158f9a2c41145831cc924296cde1f312b3f

FossilOrigin-Name: 44e83f8b8fab5b46fd50461b5bad9b31437607f259e8b284852ca3be0d376c8a

2 years agoDisallow the one-pass optimization for DELETE if the WHERE clause contains
drh [Wed, 15 Mar 2023 17:58:51 +0000 (17:58 +0000)] 
Disallow the one-pass optimization for DELETE if the WHERE clause contains
a subquery.  Fix for the problem reported by
[forum:/forumpost/e61252062c9d286d|forum post e61252062c9d286d].  This fix
is more restrictive than necessary.  It could be relaxed if the subquery does
not involve the table that is the subject of the DELETE.

FossilOrigin-Name: 73f0036f045bf37193b6e87ae45b578c5831614c530488257c69666178da3aa5

2 years agoFix a broken assert() in the recovery extension.
dan [Wed, 15 Mar 2023 13:53:47 +0000 (13:53 +0000)] 
Fix a broken assert() in the recovery extension.

FossilOrigin-Name: 4c4e66f293d7768cceb875a936ca0f4cd910473e20b9910698cc1e1ce221a7d4

2 years agoFix Bloom filters on an expression index.
drh [Tue, 14 Mar 2023 20:08:39 +0000 (20:08 +0000)] 
Fix Bloom filters on an expression index.
[forum:/forumpost/2e427099d5|forum post 2e427099d5] and
[forum:/forumpost/d47a0e8e3a|forum post d47a0e8e3a].

FossilOrigin-Name: c028fb669a5ae34dbaf50fffab1ae49bc568b994435cf02e145d24da3cfb48d7

2 years agoInclude CLI's tip for -- in all builds. Better show optionality of its non-option...
larrybr [Mon, 13 Mar 2023 16:08:44 +0000 (16:08 +0000)] 
Include CLI's tip for -- in all builds. Better show optionality of its non-option arguments.

FossilOrigin-Name: 9e2c771daad485d923751fdee0316b195bb49ec9f865f2e39565906edeaa5cf8

2 years agoThe check-in at [198b3e33dcfd74c7] caused a performance regression for some
drh [Sat, 11 Mar 2023 23:21:21 +0000 (23:21 +0000)] 
The check-in at [198b3e33dcfd74c7] caused a performance regression for some
queries, which is here fixed.  Problem reported by
[forum:/forumpost/b405033490fa56d9|forum post b405033490fa56d9].

FossilOrigin-Name: dc9f025dc43cb8008e7d8d644175d8b2d084e602a1513803c40c513d1e99fea4

2 years agoCLI help to reflect no-more-options option
larrybr [Sat, 11 Mar 2023 00:15:41 +0000 (00:15 +0000)] 
CLI help to reflect no-more-options option

FossilOrigin-Name: 30d95a12eb8b1cfc8ed11d3ed68cd713993ba34efa2fe623c18cfe41f14df1d9

2 years agoFix a typo in a comment. No code changes.
drh [Fri, 10 Mar 2023 21:27:59 +0000 (21:27 +0000)] 
Fix a typo in a comment.  No code changes.

FossilOrigin-Name: 76acc075402aac2d14d8279b8095008a842522a0985fdf89200da4339757a40b

2 years agoGive CLI a no-more-options option. (--)
larrybr [Fri, 10 Mar 2023 20:54:44 +0000 (20:54 +0000)] 
Give CLI a no-more-options option. (--)

FossilOrigin-Name: 0822788752621f6bf6af44b420b594ddd352634b3b0ed0eb835abea34b45817a

2 years agoFix a problem with the fts5 snippet() function that shows up when snippets just 1...
dan [Fri, 10 Mar 2023 13:36:19 +0000 (13:36 +0000)] 
Fix a problem with the fts5 snippet() function that shows up when snippets just 1 token in length are requested.

FossilOrigin-Name: 96d5116d17cbf3de6be38952881c6ddf6a226ddfd7649197bdb2df39c42b5d8e

2 years agoExport SQLITE_FCNTL_RESET_CACHE to JS.
stephan [Fri, 10 Mar 2023 11:57:23 +0000 (11:57 +0000)] 
Export SQLITE_FCNTL_RESET_CACHE to JS.

FossilOrigin-Name: 6195cfc86b15614b8db0e0dc5cc79b8d1acaf483f0131c8526992dc8ca075630

2 years agoReplace a lingering use of 'self' with 'globalThis' in JS code, for node compatibility.
stephan [Thu, 9 Mar 2023 22:09:13 +0000 (22:09 +0000)] 
Replace a lingering use of 'self' with 'globalThis' in JS code, for node compatibility.

FossilOrigin-Name: 7e3782b5aa07621db95c2dc25b25ae21da988c9876d537b78ea289a83c75b06b

2 years agoReinstate some test cases accidentally removed by [cb023fe28560ce0f].
dan [Thu, 9 Mar 2023 16:11:43 +0000 (16:11 +0000)] 
Reinstate some test cases accidentally removed by [cb023fe28560ce0f].

FossilOrigin-Name: 870de61f8ef8781f2f9969b012f5c1cb95b6bce1a9a4dcaf02945b7846c3aa83

2 years agoFix countofview.test so that it works with SQLITE_OMIT_PROGRESS_CALLBACK builds.
dan [Thu, 9 Mar 2023 15:08:06 +0000 (15:08 +0000)] 
Fix countofview.test so that it works with SQLITE_OMIT_PROGRESS_CALLBACK builds.

FossilOrigin-Name: 2fc7c3fcee05c2a251ceb3666f3f6e9014cfe6e2f8570b72c43f251067e6b252

2 years agoExperimental addition of sqlite3-node.mjs, for node.js, based on feedback from [forum...
stephan [Thu, 9 Mar 2023 08:51:04 +0000 (08:51 +0000)] 
Experimental addition of sqlite3-node.mjs, for node.js, based on feedback from [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235] and related off-list discussions. Build changes only - no code changes.

FossilOrigin-Name: a5db97fa17d15711ab19af70595912d342ffa326a9b7029d4deb2194ae72a9f0

2 years agoFix a possible NULL pointer dereference due to the sqlite3_interrupt()
drh [Wed, 8 Mar 2023 23:05:18 +0000 (23:05 +0000)] 
Fix a possible NULL pointer dereference due to the sqlite3_interrupt()
enhancement at [bd8fa10e59f58886].  Reported by
[forum:/forumpost/f5a2b1db87|forum post f5a2b1db87].

FossilOrigin-Name: 84417bbd144b2197c9930a520feb94b59053957c190be79f8deaaaebca68ecf1

2 years agoBackout the OP_MakeRecord optimization as it does not work.
drh [Wed, 8 Mar 2023 22:48:03 +0000 (22:48 +0000)] 
Backout the OP_MakeRecord optimization as it does not work.

FossilOrigin-Name: 25017312d0d476d9cd5a39835748ee26c2ea482e163264ce2f9843ac627276d6

2 years agoExport the new SQLITE_CHANGESETAPPLY_IGNORENOOP flag to JS.
stephan [Wed, 8 Mar 2023 18:05:57 +0000 (18:05 +0000)] 
Export the new SQLITE_CHANGESETAPPLY_IGNORENOOP flag to JS.

FossilOrigin-Name: ac7359b2633ead74a53b2796fe038ca285aacad45b45980db2a76a87154e66e3

2 years agoAdd the SQLITE_CHANGESETAPPLY_IGNORENOOP flag, which may be passed to sqlite3changese...
dan [Wed, 8 Mar 2023 18:03:04 +0000 (18:03 +0000)] 
Add the SQLITE_CHANGESETAPPLY_IGNORENOOP flag, which may be passed to sqlite3changeset_apply_v2() to have it ignore changes that would be no-ops if applied to the database (e.g. deleting a row that has already been deleted), instead of considering them conflicts.

FossilOrigin-Name: cb023fe28560ce0f8c2fd48042553fcdb9db81eba9552be75165de0d46a2645c

2 years agoSmall performance improvement in the OP_MakeRecord opcode.
drh [Wed, 8 Mar 2023 17:09:32 +0000 (17:09 +0000)] 
Small performance improvement in the OP_MakeRecord opcode.

FossilOrigin-Name: ca89daef0fcf6cb04aa6fa90dd333d6f2474bf3f458c833d9cd5bd8e59f2a04a

2 years agoChange to [44135d6ea84f7ba6] that retains the historical datatype ("INT", not "NUM...
drh [Wed, 8 Mar 2023 14:28:09 +0000 (14:28 +0000)] 
Change to [44135d6ea84f7ba6] that retains the historical datatype ("INT", not "NUM") for a table created as follows: "CREATE TABLE t1 AS SELECT CAST(123 AS INT) AS value;".  The use of FLEXNUM only occurs on compound queries.

FossilOrigin-Name: 6d5b5896261c62a7e130b47416ee8c25793859a2afcb1646c257600537a5b71b

2 years agoExtend wasm build to support a custom sqlite3.c to support building against sqlite3...
stephan [Wed, 8 Mar 2023 10:05:42 +0000 (10:05 +0000)] 
Extend wasm build to support a custom sqlite3.c to support building against sqlite3-see.c. The JS code now binds the SEE-specific functions if it detects an SEE build.

FossilOrigin-Name: dd8612c8adbaf9d06bf0d7319b9afc9bd8ca3d0fcfa1cb591a7a2fcb86480048

2 years agoFix a problem in the count-of-view optimization that can lead to incorrect
drh [Wed, 8 Mar 2023 00:47:53 +0000 (00:47 +0000)] 
Fix a problem in the count-of-view optimization that can lead to incorrect
bytecode.  dbsqlfuzz 23d782160b71c3f8f535ccb2da313dfc8eb8c631.

FossilOrigin-Name: f45009533a79a59b302598ee2545ef787c51d0128f4e1dca60dd83589f660619

2 years agoFix a bug introduced 4 days ago by [e95439119ac200cb]: do not set the
drh [Tue, 7 Mar 2023 23:47:38 +0000 (23:47 +0000)] 
Fix a bug introduced 4 days ago by [e95439119ac200cb]: do not set the
Expr.affExpr field of a generated column expression if the expression is a
RAISE() function, as affExpr has a different meaning for RAISE.
[forum:/forumpost/b312e075b5|Forum post b312e075b5].

FossilOrigin-Name: 1096b5a7cc8104db01f8820ace47020baad2f12e6711e3a7b4514ed1becc7b66

2 years agoA proposed change to [44135d6ea84f7ba6] that retains the flexnum-proposed-fix
drh [Tue, 7 Mar 2023 19:39:18 +0000 (19:39 +0000)] 
A proposed change to [44135d6ea84f7ba6] that retains the
historical datatype ("INT", not "NUM") for a table created as follows:
"<tt>CREATE TABLE t1 AS SELECT CAST(123 AS INT) AS value;</tt>".

FossilOrigin-Name: a0e54fe2058a4ac1e794b2491e424c60dfa42c6781b1cfd83c5db65c28c11c71

2 years agoImprove how sqlite3.initWorker1API() determines whether it's running in a Worker...
stephan [Tue, 7 Mar 2023 19:23:36 +0000 (19:23 +0000)] 
Improve how sqlite3.initWorker1API() determines whether it's running in a Worker thread. Based on feedback in [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235].

FossilOrigin-Name: 2f712b836a0dafd0b2ee6ba4eaa9caa35e49375c7ad0562477e0f2d3b086ec03

2 years agoReplace use of 'self' in JS code with 'globalThis', as that works in browsers and...
stephan [Tue, 7 Mar 2023 19:12:06 +0000 (19:12 +0000)] 
Replace use of 'self' in JS code with 'globalThis', as that works in browsers and node environments. Avoid using globalThis.location if it's not set (e.g. in node). Based on feedback in [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235]. Minor JS build tweaks.

FossilOrigin-Name: dbbe8f25e58738c10b6192d41f1e3886983871f17631cbc45ce626d3f05a6e26

2 years agoIn the JS sqlite3.vfs/vtab utility APIs, use a local reference to StructBinder instea...
stephan [Tue, 7 Mar 2023 12:59:20 +0000 (12:59 +0000)] 
In the JS sqlite3.vfs/vtab utility APIs, use a local reference to StructBinder instead of sqlite3.StructBinder, as that object is removed from the sqlite3 namespace during the final steps of API initialization. Based on feedback from [forum:d19d96183badca70|forum post d19d96183badca70].

FossilOrigin-Name: 0d89885d28b44b1858117a72a180841f4f5f44bcc574fc59a116ca3526325932

2 years agoFix a couple minor spacing issues in the MSVC makefile.
mistachkin [Tue, 7 Mar 2023 02:24:43 +0000 (02:24 +0000)] 
Fix a couple minor spacing issues in the MSVC makefile.

FossilOrigin-Name: 46b3ac6d1fdd9207cdc511d445bb4c33d11102d6e4eb43f119293d62bb7008ff

2 years agoRepair an unintential fork.
drh [Mon, 6 Mar 2023 23:39:19 +0000 (23:39 +0000)] 
Repair an unintential fork.

FossilOrigin-Name: 8b524c849f9844ea624cfe8968225200a57cefa8b7a17ebac2153c0cb3b657d7

2 years agoImprovements to query invariant testing such that it uses the new
drh [Mon, 6 Mar 2023 23:38:44 +0000 (23:38 +0000)] 
Improvements to query invariant testing such that it uses the new
SQLITE_DBCONFIG_REVERSE_SCANORDER opcode to sqlite3_db_config() to make more
accurate judgements about when a query is ambiguous, and hence when query
invariant testing is approprate.

FossilOrigin-Name: be9ab292cd14889b1c9648b47138260b33fe5be282ff2d90653b1387885a7d02

2 years agoCause CLI to fail noisily when deserialize option used for non-seekable "file".
larrybr [Mon, 6 Mar 2023 21:38:38 +0000 (21:38 +0000)] 
Cause CLI to fail noisily when deserialize option used for non-seekable "file".

FossilOrigin-Name: 24bd7e82471925987d924188ce0f80ed4f282b10ea1022e42881a7f529814eb9

2 years agoAdd SQLITE_DBCONFIG_REVERSE_SCANORDER for direct C-language access to the
drh [Mon, 6 Mar 2023 19:04:39 +0000 (19:04 +0000)] 
Add SQLITE_DBCONFIG_REVERSE_SCANORDER for direct C-language access to the
"PRAGMA reverse_unordered_selects" setting.

FossilOrigin-Name: 83e84531b46814aea6dad1ce8283cb9f6b90ad52badb60b875ea8f66e4ac0925

2 years agoRename sqlite3-worker1-bundler-friendly.js to sqlite3-worker1-bundler-friendly.mjs...
stephan [Sun, 5 Mar 2023 07:44:23 +0000 (07:44 +0000)] 
Rename sqlite3-worker1-bundler-friendly.js to sqlite3-worker1-bundler-friendly.mjs and refactor it to work as an ES6 module, based on feedback in [forum post a255f89c2eadf4c4|forum:a255f89c2eadf4c4].

FossilOrigin-Name: af312b131457743d98b84137bd51d9ba60e0daf0bd8f5a66f05956ca35ab68fb

2 years agoCorrect rendering of error messages in demo-worker1.js. Remove some stray EOL whitespace.
stephan [Sun, 5 Mar 2023 07:33:11 +0000 (07:33 +0000)] 
Correct rendering of error messages in demo-worker1.js. Remove some stray EOL whitespace.

FossilOrigin-Name: 1d5d515ad97cf61bd679f8c1afc607815c079583fe80264b591c6ef18f56fb8b

2 years agoFix to check-in [b9190d3da70c4171] - the agg-with-indexed-expr optimization
drh [Sat, 4 Mar 2023 15:36:51 +0000 (15:36 +0000)] 
Fix to check-in [b9190d3da70c4171] - the agg-with-indexed-expr optimization
requested by ticket [99378177930f87bd] - that can cause an incorrect answer
if an aggregate subquery has a GROUP BY clause, and that GROUP BY contains a
term that is not in the result set, and the outer query makes use of expression
indexes.  Problem reported by
[forum:/forumpost/a68313d054|forum post a68313d054].

FossilOrigin-Name: e06973876993926fd56181281d04b8dd504c689abf883fa21a5721cc1d478ea8

2 years agoShow the output value from OP_AggFinal when doing byte-code tracing.
drh [Sat, 4 Mar 2023 12:57:07 +0000 (12:57 +0000)] 
Show the output value from OP_AggFinal when doing byte-code tracing.

FossilOrigin-Name: 35f10a06ba81b8a526249729828fff06214e9cf95de418a9081f19d8d69fd657

2 years agoMake the SQLITE_DBCONFIG_STMT_SCANSTATUS option on by default.
dan [Fri, 3 Mar 2023 21:17:12 +0000 (21:17 +0000)] 
Make the SQLITE_DBCONFIG_STMT_SCANSTATUS option on by default.

FossilOrigin-Name: 5a09191186bc03b374e0c0d029e1a15208c6b845bc2f5f5f9f6a8a882809d9f3

2 years agoFix a vdbe-coverage macro added by [f418bdd627e84e7d].
drh [Fri, 3 Mar 2023 19:56:19 +0000 (19:56 +0000)] 
Fix a vdbe-coverage macro added by [f418bdd627e84e7d].

FossilOrigin-Name: 77f559d2647615379fed55ced5d69ae90515273e59811b92171bdd3089c90a22

2 years agoFollow-up to [e95439119ac200cb] to fix a case where a pointer is NULL due to
drh [Fri, 3 Mar 2023 19:43:39 +0000 (19:43 +0000)] 
Follow-up to [e95439119ac200cb] to fix a case where a pointer is NULL due to
OOM.

FossilOrigin-Name: 2535bc8c256a7642a6ac00ebfd3393beb93da94394c13b886c3ddd20d114aa3c

2 years agoEnhance PRAGMA integrity_check so that it can detect when there are extra
drh [Fri, 3 Mar 2023 18:35:00 +0000 (18:35 +0000)] 
Enhance PRAGMA integrity_check so that it can detect when there are extra
bytes at the end of an index record, which might cause OP_IdxRowid to
malfunction.  dbsqlfuzz c1aa3986534d5feab8d21f28b3c1712df2ef358ba.  Test case
in TH3.

FossilOrigin-Name: f418bdd627e84e7d494f730d7124d8f4846ebcde031f5b2498685c9aceebb3c8

2 years agoWhen it is known when preparing a statement that X cannot be NULL, transform the...
dan [Fri, 3 Mar 2023 16:25:18 +0000 (16:25 +0000)] 
When it is known when preparing a statement that X cannot be NULL, transform the expression (X IS NULL) to integer value 1 instead of 'true'. This is because under some circumstances, "Y IS TRUE" may not be equivalent to "Y IS 1".

FossilOrigin-Name: cc4bb05b3653e9502b95ea6fe0bfb77feebc11285b66e1dde4c7b945928efbf1

2 years agoDo not use an expression index on a generated column if generated column
drh [Fri, 3 Mar 2023 15:12:46 +0000 (15:12 +0000)] 
Do not use an expression index on a generated column if generated column
has the wrong affinity.  dbsqlfuzz 65f5eb57f8859344d5f1f33e08c77ee12960ed83

FossilOrigin-Name: e95439119ac200cb47d0e277622f41ee7986b364487cd252b485ce5fa030d70f

2 years agoRemove unnecessary call to sqlite3_dbdata_init() from shell.c.in.
dan [Fri, 3 Mar 2023 10:42:23 +0000 (10:42 +0000)] 
Remove unnecessary call to sqlite3_dbdata_init() from shell.c.in.

FossilOrigin-Name: c4d083a3aeeee69342d41b93a1393855871b0e4e7bfdb5fcc2973138018f248b

2 years agoWhen flattening the right operand of a LEFT JOIN
drh [Thu, 2 Mar 2023 13:49:50 +0000 (13:49 +0000)] 
When flattening the right operand of a LEFT JOIN
(check-in [41c27bc0ff1d3135]), ensure that the OP_IfNullRow opcode does not
NULL-out a subquery result that was computed within OP_Once.  This fixes
the problem problem reported by
[forum:/forumpost/402f05296d|forum post 402f05296d].

FossilOrigin-Name: 8fe13f7a5e5eb798189acb25a608df7a94c2f5cc83463331a048b779c7890c82

2 years agoResolve a parallel build timing issue when building sqlite3.c/h from ext/wasm. For...
stephan [Thu, 2 Mar 2023 06:58:55 +0000 (06:58 +0000)] 
Resolve a parallel build timing issue when building sqlite3.c/h from ext/wasm. For the time being, do not add sqlite3_wasm_extra_init.c to fiddle.wasm because it can cause duplicate definitions of extensions which are already built into the shell (a better resolution for this conflict is pending). No longer add sqlite3_wasm_extra_init.c to speedtest1.wasm because it's useless there.

FossilOrigin-Name: 75fdd5b83b4c527d25649b0d08841e3dc7d4d8109c1c97b2195b303538ced73d

2 years agoRename some vars in the ext/wasm makefiles for consistency's sake.
stephan [Thu, 2 Mar 2023 05:51:03 +0000 (05:51 +0000)] 
Rename some vars in the ext/wasm makefiles for consistency's sake.

FossilOrigin-Name: c23589d92cd16b67266d97f4a3d8c0991864dbea30ec074173e1a67466532d21

2 years agoWhen flattening a view that is the right operand of a LEFT JOIN, using
drh [Wed, 1 Mar 2023 20:23:46 +0000 (20:23 +0000)] 
When flattening a view that is the right operand of a LEFT JOIN, using
the optimization of check-in [41c27bc0ff1d3135], always insert the
TK_IF_NULL_ROW expression nodes, even for TK_COLUMN expressions, as
the TK_COLUMN might be a column from an outer query and hence still need
to be NULLed out. This fixes the problem described by
[forum:/forumpost/26387ea7ef|forum post 26387ea7ef].

FossilOrigin-Name: 198b3e33dcfd74c7ba6abcf789ee81dfed464a50ebf15c8edeff349d36789fca

2 years agoFollow-up to [bbaf1f2eb1e1637b]: Make sure subtypes do not cross a subquery
drh [Wed, 1 Mar 2023 15:21:53 +0000 (15:21 +0000)] 
Follow-up to [bbaf1f2eb1e1637b]: Make sure subtypes do not cross a subquery
boundary even if the function that returned the value with a subtype is
buried down inside a larger expression.  This fixes a problem identified
by [forum:/forumpost/37dd14a538|forum post 37dd14a538].

FossilOrigin-Name: e72661eb680ea707a839cb3d5cf6c7ef03706e7b40af1b84760147e59cd61a50

2 years agoDo not attempt to apply the count-of-view optimization to a CTE.
drh [Wed, 1 Mar 2023 13:54:07 +0000 (13:54 +0000)] 
Do not attempt to apply the count-of-view optimization to a CTE.
dbsqlfuzz ef8623915d843b150c159166ee4548c78cc6895a

FossilOrigin-Name: abc3a383636c0346053b5d09d96585f56c64cacb5751673ea3bf339e4955d1cd

2 years agoActivate SQLITE_DBCONFIG_STMT_SCANSTATUS in fuzzcheck.
drh [Tue, 28 Feb 2023 21:23:46 +0000 (21:23 +0000)] 
Activate SQLITE_DBCONFIG_STMT_SCANSTATUS in fuzzcheck.

FossilOrigin-Name: 4fe1419ac3161ea8735241b04913593170c636cf3e1583756fe94edd396cd38b

2 years agoUpdates to speedtest1.c and the speed-check.sh test script so that they work
drh [Tue, 28 Feb 2023 20:06:30 +0000 (20:06 +0000)] 
Updates to speedtest1.c and the speed-check.sh test script so that they work
with the new SQLITE_DBCONFIG_STMT_SCANSTATUS control.

FossilOrigin-Name: bd02df052e1ef78b5335915a38f3c5e13c3c04ab82fd251aeb42a440d1d39257

2 years agoChange the name of SQLITE_DBCONFIG_STMT_SCANSTATS to SQLITE_DBCONFIG_STMT_SCANSTATUS.
dan [Tue, 28 Feb 2023 20:04:01 +0000 (20:04 +0000)] 
Change the name of SQLITE_DBCONFIG_STMT_SCANSTATS to SQLITE_DBCONFIG_STMT_SCANSTATUS.

FossilOrigin-Name: a63e4a150b505fc309fac847131009ee9965eb1b798ebcb202ec8b52f9189240

2 years agoAdd an sqlite3_db_config() option - SQLITE_DBCONFIG_STMT_SCANSTATS - for enabling...
dan [Tue, 28 Feb 2023 19:39:59 +0000 (19:39 +0000)] 
Add an sqlite3_db_config() option - SQLITE_DBCONFIG_STMT_SCANSTATS - for enabling and disabling the collection of sqlite3_stmt_scanstats() statistics in SQLITE_ENABLE_STMT_SCANSTATUS builds. Collection of statistics is disabled by default.

FossilOrigin-Name: 0f5579bef27b84ee855065cfe87703c51e1f9773906a9e0d4e4dafc90bd0e553

2 years agoOnly use a Bloom filter on an automatic index if one or more of the key
drh [Tue, 28 Feb 2023 18:06:52 +0000 (18:06 +0000)] 
Only use a Bloom filter on an automatic index if one or more of the key
columns in the index can take on non-TEXT values.

FossilOrigin-Name: 5916705c731604d2e6b51a307cc8d7b67f4c102062bfdfcbc716a2916e0b0d86

2 years agoIn the Bloom filter optimization, hash all strings and blobs into the same
drh [Tue, 28 Feb 2023 14:28:54 +0000 (14:28 +0000)] 
In the Bloom filter optimization, hash all strings and blobs into the same
value, because we do not know if two different strings might compare equal
even if they have different byte sequences, due to collating functions.
Formerly, the hash of a string or blob was just its length.  This could
all be improved.  Fix for the issue reported by
[forum:/forumpost/0846211821|forum post 0846211821].

FossilOrigin-Name: 090304b870419acb5b05205a07fc75830b556928149f76a843cda526f77a6fc0

2 years agoWhen an automatic index creates a Bloom filter, show that in the
drh [Tue, 28 Feb 2023 13:46:01 +0000 (13:46 +0000)] 
When an automatic index creates a Bloom filter, show that in the
EXPLAIN QUERY PLAN output.

FossilOrigin-Name: d7b2ac1c1a31fa4285cf6df0995db7e7705bb6a1bc94850c14c94cc4e3eb239a

2 years agoPerformance optimization in the varint decoder for the cell parser.
drh [Tue, 28 Feb 2023 12:31:40 +0000 (12:31 +0000)] 
Performance optimization in the varint decoder for the cell parser.

FossilOrigin-Name: b2b91c7cb40f1efe800059614e34823411016a3ece3f988e1574aecadd4c3114

2 years agoImprove the error message generated by the recovery extension if it is used with...
dan [Tue, 28 Feb 2023 11:02:02 +0000 (11:02 +0000)] 
Improve the error message generated by the recovery extension if it is used with a non-SQLITE_ENABLE_DBPAGE_VTAB build.

FossilOrigin-Name: c1f2a1d55c180fb51a4e203befbbe529bdd23137b26190c50b8f85820450e7fa

2 years agoMinor performance optimization in the computation of an affinity string
drh [Mon, 27 Feb 2023 18:55:37 +0000 (18:55 +0000)] 
Minor performance optimization in the computation of an affinity string
for an index.

FossilOrigin-Name: 07334aa17b6ded27c5bd353998d96645a94cdcf32440abb59d127a002cd98ce9

2 years agoFurther to [46639f682975dac6], the parameters of a table valued function that
drh [Mon, 27 Feb 2023 14:48:54 +0000 (14:48 +0000)] 
Further to [46639f682975dac6], the parameters of a table valued function that
is on the left side of a RIGHT JOIN do not need to be in the ON clause.  Add
new test cases and tags to associated test cases with the code.

FossilOrigin-Name: 18ee689de3d1ae43b05ca52e0b62c49442ebf68a88814a7c679e8856250a4b0d

2 years agoMinor doc tweak for the previous commit.
stephan [Mon, 27 Feb 2023 07:23:54 +0000 (07:23 +0000)] 
Minor doc tweak for the previous commit.

FossilOrigin-Name: a8832164d36ea88dc1c5c874c67212800238eab6b1477e5ca92fbf8c77f341b4

2 years agoExtend wasm build to enable inclusion of client-custom C code, initialized via the...
stephan [Mon, 27 Feb 2023 07:12:28 +0000 (07:12 +0000)] 
Extend wasm build to enable inclusion of client-custom C code, initialized via the SQLITE_EXTRA_INIT mechanism, per discussion in [forum:1e1c04f3ed1bc96b|forum post 1e1c04f3ed1bc96b].

FossilOrigin-Name: 68a52cafff60f19c9c998133d04f192b1e8b23f78b8cee13807d76845ef5e13d

2 years agoWhen a table-valued function appears as the right table of a RIGHT JOIN,
drh [Sun, 26 Feb 2023 20:57:09 +0000 (20:57 +0000)] 
When a table-valued function appears as the right table of a RIGHT JOIN,
the argument constraints on the table-valued function should be considered
part of the ON clause of the RIGHT JOIN.  Fix for the problem reported
by [forum:/forumpost/422e635f3beafbf6|forum post 422e635f3beafbf6].  Test
cases in TH3.  Possibly related to the enhancement at [501609eddf2a46d5].

FossilOrigin-Name: 46639f682975dac6efec4e230aca2c9b127b4fc77e0b465fad38ef4caa9b7a4c

2 years agoIn the [/info/7c2d3406000dc8ac|omit-unused-subquery-columns optimization], be
drh [Sun, 26 Feb 2023 11:36:35 +0000 (11:36 +0000)] 
In the [/info/7c2d3406000dc8ac|omit-unused-subquery-columns optimization], be
sure to remove the EP_Skip and EP_Unlikely flags from the result set expressions
that get nulled-out.  dbsqlfuzz bf1d3ed6e0e0dd8766027797d43db40c776d2b15.

FossilOrigin-Name: 21aec65e5e2a01e58dd0bb8c8b9b29b8414373b53353fc7ca80a152fdd27566b

2 years agoSplit out a new variant of cellSizePtr() that applies only to leaf pages,
drh [Sat, 25 Feb 2023 16:03:28 +0000 (16:03 +0000)] 
Split out a new variant of cellSizePtr() that applies only to leaf pages,
for a small performance increase.

FossilOrigin-Name: 22d32eef8741ae4f2aac3869465e5a7d2e33c6bc2425dd8e77f2a746e43687e8

2 years agoRemove an unnecessary and redundant corruption checks in defragmentPage().
drh [Sat, 25 Feb 2023 15:34:09 +0000 (15:34 +0000)] 
Remove an unnecessary and redundant corruption checks in defragmentPage().

FossilOrigin-Name: 2dc7342e12e9dac2d8345d045a17caa29c26eaf6f417dd052c7c645eddd6c58c

2 years agoRevert (mostly) to earlier CLI response to -echo and SQL at the command line.
larrybr [Sat, 25 Feb 2023 15:15:40 +0000 (15:15 +0000)] 
Revert (mostly) to earlier CLI response to -echo and SQL at the command line.

FossilOrigin-Name: 1c6cfcf6ed5e084e5eb6874a261f3670ab5fb3e5dbcf150f37c58b2f16351ee3

2 years agoPerformance optimization on sqlite3_vsnprintf().
drh [Sat, 25 Feb 2023 12:50:54 +0000 (12:50 +0000)] 
Performance optimization on sqlite3_vsnprintf().

FossilOrigin-Name: 4430e6e96dbf3d0b464776c132838dd3e456716e0ae5972fc7e0ece13b56ea25

2 years agoAdd the "on" option to the ".log" command in the CLI. Allow ".log on" and
drh [Fri, 24 Feb 2023 21:23:53 +0000 (21:23 +0000)] 
Add the "on" option to the ".log" command in the CLI.  Allow ".log on" and
".log off" even in --safe mode.  Enable the .log command for fiddle builds.

FossilOrigin-Name: 6bba9100ae81466eeb49845c449cbfddf4f82f18b89f55e6ef575cbf66af63af

2 years agoIn the CLI, do not emit warnings about the incorrect usage of sqlite3_config()
drh [Fri, 24 Feb 2023 21:05:12 +0000 (21:05 +0000)] 
In the CLI, do not emit warnings about the incorrect usage of sqlite3_config()
in Fiddle.

FossilOrigin-Name: 847021b402a3e624e22959a70e3e29a4f069c2005534485779cdc018722b5863

2 years agoModify the sqlite3_config() interface so that the SQLITE_CONFIG_LOG and
drh [Fri, 24 Feb 2023 16:04:05 +0000 (16:04 +0000)] 
Modify the sqlite3_config() interface so that the SQLITE_CONFIG_LOG and
SQLITE_CONFIG_PCACHE_HDRSZ opcodes can be called after sqlite3_initialize().
Enhancement request [0b75886e6d48f7c2].

FossilOrigin-Name: 7902fb806b33a27932f9ca347246f4ac43091caad0a1536009985b650fd720e2

2 years agoBack out the SQLITE_CONFIG_URI option from anytime-config. anytime-config
drh [Fri, 24 Feb 2023 15:59:27 +0000 (15:59 +0000)] 
Back out the SQLITE_CONFIG_URI option from anytime-config.

FossilOrigin-Name: 0de98b8e21e4cbf2438160651585ea23ebea952c5a4e7d88e5eabe5cc49517b2

2 years agoAdjust testrunner.tcl to make use of the new number_of_cores TCL command
drh [Fri, 24 Feb 2023 13:45:51 +0000 (13:45 +0000)] 
Adjust testrunner.tcl to make use of the new number_of_cores TCL command
available in testfixture, and to use no more than half the available cores.

FossilOrigin-Name: e0122d3863ed03e7bb64400d6561cbc824ecb14d228949ffde443069dbb4223a

2 years agoAdd the "number_of_cores" TCL command to the testfixture.
drh [Fri, 24 Feb 2023 13:25:49 +0000 (13:25 +0000)] 
Add the "number_of_cores" TCL command to the testfixture.

FossilOrigin-Name: 16ee5a7b5d02cad51a35d5675fcc5bb50a62d1f243bde107fc89fed44ffd6a43

2 years agoMerge enhancements from trunk into the anytime-config branch.
drh [Fri, 24 Feb 2023 12:55:24 +0000 (12:55 +0000)] 
Merge enhancements from trunk into the anytime-config branch.

FossilOrigin-Name: 04b2fdf3bc986cd402e8a6c060e1b3989e60770695e2f8a4bc12c43e380a694c

2 years agoSlightly faster and more precise floating-point to decimal conversion.
drh [Fri, 24 Feb 2023 11:54:40 +0000 (11:54 +0000)] 
Slightly faster and more precise floating-point to decimal conversion.
See [forum:/forumpost/d1387c3979c7f557|forum thread d1387c3979c7f557] for
discussion.

FossilOrigin-Name: 6dea6f4738fc7d003183e94f08bd95181f23e165a966882c0bdc64708a05a607

2 years agoFix an incorrect optimization that was attempted as part of
drh [Fri, 24 Feb 2023 01:08:35 +0000 (01:08 +0000)] 
Fix an incorrect optimization that was attempted as part of
check-in [18de3a8e6b431a07].

FossilOrigin-Name: f32055e8110a2eac6c9e26d1d1e620f0668bcb475d49d309dc549cea05e1e582

2 years agoOmit unnecessary branches from the enhanced floating-point conversion
drh [Thu, 23 Feb 2023 22:08:22 +0000 (22:08 +0000)] 
Omit unnecessary branches from the enhanced floating-point conversion
logic.

FossilOrigin-Name: 32b0ba0d27481d85a4b0037ec36befcbffecdec75891eba58569acb160045553

2 years agoIncreased precision of floating-point to decimal conversions when the
drh [Thu, 23 Feb 2023 21:18:47 +0000 (21:18 +0000)] 
Increased precision of floating-point to decimal conversions when the
floating point value has no fractional part.
[forum:/forumpost/d1387c3979c7f557|Forum post d1387c3979c7f557]

FossilOrigin-Name: 18de3a8e6b431a075143631eafdcf0e1b1a21868b417394c365d46d2feca10b5

2 years agoFix harmless compiler warnings and a code indentation error.
drh [Thu, 23 Feb 2023 14:43:15 +0000 (14:43 +0000)] 
Fix harmless compiler warnings and a code indentation error.

FossilOrigin-Name: de6c5c6bb49a0beca793cdc0462da2c17bb05f3292e08dd815be29b45b59a8fb

2 years agoAllow the sqlite3_config() interface to be invoked at any time for a few
drh [Thu, 23 Feb 2023 14:22:29 +0000 (14:22 +0000)] 
Allow the sqlite3_config() interface to be invoked at any time for a few
choosen options:  SQLITE_CONFIG_LOG, SQLITE_CONFIG_URI, and
SQLITE_CONFIG_PCACHE_HDRSZ.  This list will likely change before release.

FossilOrigin-Name: e1702eb48d13c7c9b7605f1e77242672222c53059edcdc4e9cea59510715822a

2 years agoProvide -DHAVE_LOG2=0 and -DHAVE_LOG10=0 compile-time options for use on systems
drh [Thu, 23 Feb 2023 01:52:54 +0000 (01:52 +0000)] 
Provide -DHAVE_LOG2=0 and -DHAVE_LOG10=0 compile-time options for use on systems
that lack the log2() and log10() standard math library routines, to cause
SQLite to substitute its own alternatives.

FossilOrigin-Name: 7ee22f95e7a7d8650f961f20e304e56c7813e624f05655d7392ca9347748270f

2 years agoEnable the count-of-view optimization by default.
drh [Wed, 22 Feb 2023 21:47:02 +0000 (21:47 +0000)] 
Enable the count-of-view optimization by default.
Enhancement request [eaed8e36ce888f1e].

FossilOrigin-Name: a4aacdd323a854d771c8cb1e2e4cfc4fb66b0020cfed23525733603605f5c63b

2 years agoAvoid computing the values for unused result-set columns in subqueries.
drh [Wed, 22 Feb 2023 21:11:34 +0000 (21:11 +0000)] 
Avoid computing the values for unused result-set columns in subqueries.
Performance optimization request [baa5bb76c35a124c].

FossilOrigin-Name: 7c2d3406000dc8ac5a99cc205b036356b67e4b0b94738592ffc5680749696904

2 years agoUpdate the version number to 3.42.0 to begin the next development cycle.
drh [Wed, 22 Feb 2023 20:50:51 +0000 (20:50 +0000)] 
Update the version number to 3.42.0 to begin the next development cycle.

FossilOrigin-Name: 65910216393ed287dbc7e42a2598b6980183c62a64da6572cb691ff4ee23555d

2 years agoRemove the push-down optimization restriction that was added by
drh [Wed, 22 Feb 2023 20:42:15 +0000 (20:42 +0000)] 
Remove the push-down optimization restriction that was added by
check-in [1ad41840c5e0fa70] because it is no longer needed after
the enhancements to compound query processing in check-in [27655c9353620aa5]
This resolves the performance regression reported by
[forum:/forumpost/bcc4375032|forum post bcc4375032].

FossilOrigin-Name: aa6bd6dff751223e302575c60f335707e4bb820bff716cab3706b564e18ed7ed

2 years agoRemove some unnecessary bind() calls in JS code.
stephan [Tue, 21 Feb 2023 20:08:10 +0000 (20:08 +0000)] 
Remove some unnecessary bind() calls in JS code.

FossilOrigin-Name: 71215599cd8ebb970500d8366dfac40420a9a6b243ea9d6ba62d5cde28fae3d3

2 years agoUnconditionally disable -sSTRICT_JS flag in wasm build because it no longer works...
stephan [Tue, 21 Feb 2023 18:47:25 +0000 (18:47 +0000)] 
Unconditionally disable -sSTRICT_JS flag in wasm build because it no longer works with emsdk 3.1.31+.

FossilOrigin-Name: b5e0b69649e6341ffff4e62f9f68abd2a53519f73964559a133f3b708e007e98

2 years agoVersion 3.41.0 version-3.41.0
drh [Tue, 21 Feb 2023 18:09:37 +0000 (18:09 +0000)] 
Version 3.41.0

FossilOrigin-Name: 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d

2 years agoDisable DQS by default in the MSVC makefile for the amalgamation tarball.
drh [Tue, 21 Feb 2023 13:28:49 +0000 (13:28 +0000)] 
Disable DQS by default in the MSVC makefile for the amalgamation tarball.

FossilOrigin-Name: 409a19145e9558686acab730b94c6d53691b6d0efcea1e9239fc7e5863586a85

2 years agoYet another comment typo fix. No changes to working code.
drh [Tue, 21 Feb 2023 12:42:25 +0000 (12:42 +0000)] 
Yet another comment typo fix.  No changes to working code.

FossilOrigin-Name: cdbdc8013fcfa8ce1bd4f5521c8d98afc53b9c577d43e5e6d0d1e15c789b910f

2 years agoFix a minor typo in a comment. No changes to working code.
drh [Tue, 21 Feb 2023 12:34:00 +0000 (12:34 +0000)] 
Fix a minor typo in a comment.  No changes to working code.

FossilOrigin-Name: 7981671d1449b3fc6eb214deb558d91b87dc4fa6e38e24606625a146cc71664a

2 years agoFix formatting and improved documentation on the various sqlite3_file_control()
drh [Tue, 21 Feb 2023 12:30:18 +0000 (12:30 +0000)] 
Fix formatting and improved documentation on the various sqlite3_file_control()
opcodes.  Other minor documentation changes.  No changes to working code.

FossilOrigin-Name: 13280f720a4ef5a1f7f2a2fbe72f374d3a2e12be9bc0c50f7fce50d0cd28a67f

2 years agoUpdate the TEA version number to 3.41.0
drh [Mon, 20 Feb 2023 19:43:01 +0000 (19:43 +0000)] 
Update the TEA version number to 3.41.0

FossilOrigin-Name: b450a920c0c59affd105616e999205cb9d2b25a79f8a7f7f05610ddaac0f770f

2 years agoFix an incorrect #ifdef in the CLI.
drh [Mon, 20 Feb 2023 16:55:58 +0000 (16:55 +0000)] 
Fix an incorrect #ifdef in the CLI.

FossilOrigin-Name: 3c4d29cf227511bf218ef620d497dc72c708dcc819971b34c7629f3ed11803fb

2 years agoFix a harmless compiler warning.
drh [Sun, 19 Feb 2023 19:16:51 +0000 (19:16 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: b2534d8de5051a3516f4b9ee5a4b99e1dcf455e9af88c60815d2c2a479fc8566

2 years agoFix stale requirement marks and fix a typo in the documentation for
drh [Sat, 18 Feb 2023 20:31:26 +0000 (20:31 +0000)] 
Fix stale requirement marks and fix a typo in the documentation for
sqlite3_preupdate_hook().

FossilOrigin-Name: 655991f5d9afdd3281049eb430921046e0ba90eef215020c2fb149adc0d3c4c5

2 years agoFix a harmless UBSAN warning in debugging code of the new unhex() function.
drh [Sat, 18 Feb 2023 15:50:23 +0000 (15:50 +0000)] 
Fix a harmless UBSAN warning in debugging code of the new unhex() function.

FossilOrigin-Name: 315574d5cbe5c805ff2163052d986b054985984fb45bfb064d1a7b39a22b90eb