]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
2 years agoInternal cleanups in JS code. No functional changes.
stephan [Wed, 22 Mar 2023 19:57:19 +0000 (19:57 +0000)] 
Internal cleanups in JS code. No functional changes.

FossilOrigin-Name: 8fbdf7d10400c4f54fc3d8bc823f97818de860deeeed35ab6ad717260cd301e0

2 years agoThe floating-point-to-text conversion with the zero-padding option now
drh [Wed, 22 Mar 2023 16:55:35 +0000 (16:55 +0000)] 
The floating-point-to-text conversion with the zero-padding option now
renders NaN as "null".

FossilOrigin-Name: ad59fa17663bda54ec5d4e48ac24e04b87daa70c795d840cd8db382e2dd581b9

2 years agoFor consistency, the ".mode json" output from the CLI now renders infinity
drh [Wed, 22 Mar 2023 16:37:17 +0000 (16:37 +0000)] 
For consistency, the ".mode json" output from the CLI now renders infinity
in the same format as the JSON functions.

FossilOrigin-Name: abee339d5eae8b63d9579b7ec3a25f18071e675223e0bb5294c733fb618a3a26

2 years agoThe double-to-text conversion renders infinity as 9e999, so that JSON
drh [Wed, 22 Mar 2023 16:24:17 +0000 (16:24 +0000)] 
The double-to-text conversion renders infinity as 9e999, so that JSON
output is compliant and so that values can be round-tripped.

FossilOrigin-Name: b52081d0acd07dc5bdb4951a3e8419866131965260c1e3a4c9b6e673bfe3dfea

2 years agoIn the CLI, the magic parameter :inf and :nan bind floating point values
drh [Wed, 22 Mar 2023 16:01:06 +0000 (16:01 +0000)] 
In the CLI, the magic parameter :inf and :nan bind floating point values
Infinity and NaN, respectively, as an add to testing SQLite's handling of
those quantities.

FossilOrigin-Name: c70a61d8fbfb722679398c211aa48ccd84a392a6b59ba70551fe3a9fbab9a6d5

2 years agoUpdate the version number for the TEA tarball to 3.42.0, to match the core.
drh [Wed, 22 Mar 2023 14:51:22 +0000 (14:51 +0000)] 
Update the version number for the TEA tarball to 3.42.0, to match the core.

FossilOrigin-Name: 03e6918e7f749c3ca1fa66df28b203ff26680f129003e20c71ca246cf7ff34fe

2 years agoAdd ALWAYS() on a branch this is always true now due to [84417bbd144b2197].
drh [Tue, 21 Mar 2023 14:20:10 +0000 (14:20 +0000)] 
Add ALWAYS() on a branch this is always true now due to [84417bbd144b2197].

FossilOrigin-Name: badf7d0e3cfa6efaff4b132cb4ecca79a16e73197c5e275db14ccb5ff938276d

2 years agoAdd the fuzzcheck-asan.exe target to the MSVC makefile.
drh [Tue, 21 Mar 2023 12:29:50 +0000 (12:29 +0000)] 
Add the fuzzcheck-asan.exe target to the MSVC makefile.

FossilOrigin-Name: 0901bc02783527090bdaa626d946ee1e92c7c6848f3c77a799e6837f4e7f8d7b

2 years agoAdd the fuzzcheck-asan target to the main posix makefile.
drh [Tue, 21 Mar 2023 11:56:04 +0000 (11:56 +0000)] 
Add the fuzzcheck-asan target to the main posix makefile.

FossilOrigin-Name: 55e94adddba77c1d6ee6ef0c0cf37f7cdccc3bdc144ceaed675d79cdb25f48a6

2 years agoFix a valgrind error and potential buffer overread when handling a corrupt database.
dan [Tue, 21 Mar 2023 11:13:53 +0000 (11:13 +0000)] 
Fix a valgrind error and potential buffer overread when handling a corrupt database.

FossilOrigin-Name: b1e0cd6444d1f710e58129723b285cf1321679fa920fc2841492dcb489ab8b9d

2 years agoMinor change to btreeNext() to facilitate coverage testing.
drh [Mon, 20 Mar 2023 18:35:48 +0000 (18:35 +0000)] 
Minor change to btreeNext() to facilitate coverage testing.

FossilOrigin-Name: 20b3ef04d8c79e281e32676d57c7a8569fac9e782ca24337691d44d383eff7bb

2 years agoFix a problem causing a cursor to retain an out-of-date cell-info cache when processi...
dan [Mon, 20 Mar 2023 14:59:19 +0000 (14:59 +0000)] 
Fix a problem causing a cursor to retain an out-of-date cell-info cache when processing a DISTINCT query on values that are identical according to their collation sequence, but different on disk. [forum:/forumpost/e132e6cde44fb505|Forum post e123e6cde4].

FossilOrigin-Name: 1b3abc1daeac29714256b5a1d5a07a75dc986f1089054a8bee44a00583b7383a

2 years agoBack out the extra margin added to the input buffer of the CLI, as it is not
drh [Mon, 20 Mar 2023 10:43:52 +0000 (10:43 +0000)] 
Back out the extra margin added to the input buffer of the CLI, as it is not
needed.

FossilOrigin-Name: ac8d1e5de5da35fa93c3f9241a7817285920431c66f4e4593d4d5c2db9f2b960

2 years agoA better fix for the sqlite3_error_offset() problem on generated columns.
drh [Mon, 20 Mar 2023 01:55:39 +0000 (01:55 +0000)] 
A better fix for the sqlite3_error_offset() problem on generated columns.

FossilOrigin-Name: 770b3e67c89ca16b08a9234acb626917a26ea414b3bc0340f9601644cb7504f2

2 years agoExpression errors in generated columns should not generate non-negative
drh [Mon, 20 Mar 2023 00:53:56 +0000 (00:53 +0000)] 
Expression errors in generated columns should not generate non-negative
sqlite3_error_offset() returns.  Second of two defenses against
[33aa4c0de8a62e33].

FossilOrigin-Name: 2adb4e0dda471ffc9b2a5cbad01b6c2bc6091b7526a8c8b19944cb2d4a5111e7

2 years agoWhen reporting errors in the CLI, ignore the output of sqlite3_error_offset()
drh [Mon, 20 Mar 2023 00:48:40 +0000 (00:48 +0000)] 
When reporting errors in the CLI, ignore the output of sqlite3_error_offset()
if the value returned is clearly out-of-range.  One of two lines of defense
against [33aa4c0de8a62e33].

FossilOrigin-Name: 26adbb80f51b9219ab2a3593496458b74a567ba5ee46b5154f056e389cfc09f7

2 years agoIncrease the size of ref-count values in the pager layer to 64-bits, to avoid
drh [Sun, 19 Mar 2023 21:48:55 +0000 (21:48 +0000)] 
Increase the size of ref-count values in the pager layer to 64-bits, to avoid
any reasonable possiblity of overflowing the counters.
There is a performance and memory penality for this.
[forum:/forumpost/b741f15a35|Forum post b741f15a35].

FossilOrigin-Name: 6c5d99a813e8498c2ea91383ac8886a43eaf47023919c03900e893640c03778d

2 years agoAvoid a buffer overread in fts3 that could occur when processing a corrupt record.
dan [Sat, 18 Mar 2023 16:12:27 +0000 (16:12 +0000)] 
Avoid a buffer overread in fts3 that could occur when processing a corrupt record.

FossilOrigin-Name: 02ac2297abee6af64c8df230b42b07f21cff4565d7e315860b2396a7c0c556ca

2 years agoFix json rendering so that it shows positive and negative infinity as numeric-only-json
drh [Fri, 17 Mar 2023 20:31:24 +0000 (20:31 +0000)] 
Fix json rendering so that it shows positive and negative infinity as
9.0e+999 and -9.0e+999 respectively.

FossilOrigin-Name: efce4690a52592c4f5fc7d023eebe771b0e615bb03c0fe203493f853b28e8f85

2 years agoAdd the ability to name functions using one of the join keywords like
drh [Fri, 17 Mar 2023 19:18:17 +0000 (19:18 +0000)] 
Add the ability to name functions using one of the join keywords like
CROSS FULL INNER LEFT NATURAL OUTER RIGHT.

FossilOrigin-Name: 0910b1925e97f7ae4dae86894c9e2f54273c85115e19d0d9bff1280ffee35eed

2 years agoAdd test cases for functions named the same as join keywords. functions-named-left
drh [Fri, 17 Mar 2023 19:07:48 +0000 (19:07 +0000)] 
Add test cases for functions named the same as join keywords.

FossilOrigin-Name: 94944b239ce674d984c88ef6029b0260a972f1b25f01614b559ca07c3ebaf8f5

2 years agoFix a potential buffer overread in the recovery extension.
dan [Fri, 17 Mar 2023 14:18:39 +0000 (14:18 +0000)] 
Fix a potential buffer overread in the recovery extension.

FossilOrigin-Name: 0b3b5bf9597615589a1d045aaa697c13550553ee4fe4b9008a8e51415b6fe96a

2 years agoEnsure that an error does not delete the Table object out from under
drh [Fri, 17 Mar 2023 10:43:05 +0000 (10:43 +0000)] 
Ensure that an error does not delete the Table object out from under
the xConstruct method of a virtual table.
dbsqlfuzz 7cc8804a1c6d4e3d554d79096e6ea75a7c1c7d2d

FossilOrigin-Name: df4928c92b0db77d0a40d7b492b609db191252e2f87bca63d000e4fe2e206293

2 years agoAdd safety margin on the CLI input buffer for tickets
drh [Fri, 17 Mar 2023 00:42:27 +0000 (00:42 +0000)] 
Add safety margin on the CLI input buffer for tickets
[33aa4c0de8a62e33], [b97e6c5e6a91d97f], [2971fbe3f993e95a], and
[2971fbe3f993e95a].

FossilOrigin-Name: 741af08af1b93406a120580379d13e514524af627da5387ecfa6e442d004bfdd

2 years agoFix assert() statements that would (incorrectly) fire if an IF NOT EXISTS
drh [Fri, 17 Mar 2023 00:01:32 +0000 (00:01 +0000)] 
Fix assert() statements that would (incorrectly) fire if an IF NOT EXISTS
trigger that already exists contained two or more RETURNING clauses.
Tickets [89d259d45b855a0d] and [d15b3a4ea901ef0d].

FossilOrigin-Name: 648899e4ded72cac6cc24bccf7ebfc709ee7309a003452b21fd6ab0ba20c34b8

2 years agoCorrectly handle SELECT DISTINCT ... ORDER BY when all of the result set terms
drh [Thu, 16 Mar 2023 20:54:29 +0000 (20:54 +0000)] 
Correctly handle SELECT DISTINCT ... ORDER BY when all of the result set terms
are constant and there are more result set terms than ORDER BY terms.
Fix for these tickets: [c36cdb4afd504dc1], [4051a7f931d9ba24],
[d6fd512f50513ab7].

FossilOrigin-Name: 12ad822d9b827777526ca5ed5bf3e678d600294fc9b5c25482dfff2a021328a4

2 years agoAdditional debug/test output from the query invariant checker showing the
drh [Thu, 16 Mar 2023 12:28:48 +0000 (12:28 +0000)] 
Additional debug/test output from the query invariant checker showing the
row-number that is being checked.

FossilOrigin-Name: e4b6eb58e65f7fa0c92768f42bc820614169b7c2f37ded391b866ddb0d894de0

2 years agoUpdate the tracing output for the query-invariant checker such that it shows
drh [Thu, 16 Mar 2023 11:50:44 +0000 (11:50 +0000)] 
Update the tracing output for the query-invariant checker such that it shows
the SQL that is run to verify that a found query-invariant discrepency is
valid.  Changes to testing logic only.

FossilOrigin-Name: 8f45ad27403e971d88ec62e674c03f82eb19df0b43aa58d20b3400cdb6611d90

2 years agoDo not use the one-pass optimization on an UPDATE if there is a subquery
drh [Thu, 16 Mar 2023 10:17:30 +0000 (10:17 +0000)] 
Do not use the one-pass optimization on an UPDATE if there is a subquery
in the WHERE clause, since if the subquery is hidden behind a short-circuit
operator, the subquery might not be evaluated until after one or more rows
have been updated.  Fix for the problem reported by
[forum:/forumpost/0007d1fdb1|forum post 0007d1fdb1].  This is the same
problem that was fixed by [73f0036f045bf371] only for UPDATE instead of
DELETE.

FossilOrigin-Name: 2c56b984a0bd3be5ec326a2109ea7b8f1d4ef63c8fc325caac9663cf2479eaff

2 years agoRemove a NEVER() from btreeNext() that dbsqlfuzz 460aa158f9a2c41145831cc924296cde1f312b3f
drh [Thu, 16 Mar 2023 09:07:46 +0000 (09:07 +0000)] 
Remove a NEVER() from btreeNext() that dbsqlfuzz 460aa158f9a2c41145831cc924296cde1f312b3f
found could sometimes be reached.  I will find a way to test that branch
later.

FossilOrigin-Name: 1dffeffe150fff6777cf26bc960326ca4e4190d25d05bb066b082d1e1c8eb374

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 agoAllow functions named using keywords "CROSS", "FULL", "INNER", "LEFT",
drh [Sat, 11 Mar 2023 12:27:12 +0000 (12:27 +0000)] 
Allow functions named using keywords "CROSS", "FULL", "INNER", "LEFT",
"NATURAL", "OUTER", and "RIGHT".

FossilOrigin-Name: eeac3d5ec93e9cf8613d764b700b6e39a3ffb39b3953ce1e6a2f84dd986f9e86

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