]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
2 years agoAdd usage detection to the NULL value generator for the left table of a rightjoin-agg-idxexpr
drh [Sat, 25 Mar 2023 23:40:21 +0000 (23:40 +0000)] 
Add usage detection to the NULL value generator for the left table of a
RIGHT JOIN inside of an aggregate.

FossilOrigin-Name: 4d05a009dfb63bcb4173da4d09ccc00c308ce4dd2534a32aeb23c5d8d6a1fd4b

2 years agoWhen the left table of a RIGHT JOIN is used inside an aggregate function
drh [Sat, 25 Mar 2023 21:01:11 +0000 (21:01 +0000)] 
When the left table of a RIGHT JOIN is used inside an aggregate function
and the left table employs an index on expressions, then make sure the
expressions evaluate to NULL for the cases where the left table should be
NULL.  Proposed fix for [forum:/forumpost/9b491e1deb|forum post 9b491e1deb].
More testing an analysis needed - there is a FIXME in this check-in.

FossilOrigin-Name: 3572b40a7dfc4acc35e72e08e79f64688f8737e57ac89e4d10e6b32bd5178c63

2 years agoIn the byte-code, when the result of an expression needs to be in a particular
drh [Sat, 25 Mar 2023 19:44:25 +0000 (19:44 +0000)] 
In the byte-code, when the result of an expression needs to be in a particular
register, always use the sqlite3ExprCode() routine because it has the smarts
to know whether to use OP_Copy or OP_SCopy.  Do not try to OP_SCopy inline
because an OP_Copy might be required.  Fix for the problem identified by
[forum:/forumpost/5522082cfc|forum post 5522082cfc].

FossilOrigin-Name: c104e5c6eeb89575319d9f94f49446142b06912fa8b283c19d46aa2ccddc5bda

2 years agoAdd the tag-20230325-1 comment that was omitted from the prior check-in.
drh [Sat, 25 Mar 2023 18:41:42 +0000 (18:41 +0000)] 
Add the tag-20230325-1 comment that was omitted from the prior check-in.

FossilOrigin-Name: a13c01d076d23f0de500e8e6283e803dfc96f0da7509c0d97d598d6b3e7b930b

2 years agoThe fix at [2bf5413dc2c19d5f] was incomplete in that it failed to clear
drh [Sat, 25 Mar 2023 18:31:24 +0000 (18:31 +0000)] 
The fix at [2bf5413dc2c19d5f] was incomplete in that it failed to clear
the reusable register cache that might contain registers in the STAT4
buffer region.  This additional change corrects the problem.
[forum:/forumpost/83cb4a95a0|Forum post 83cb4a95a0].  Test case in TH3.

FossilOrigin-Name: 5d554e4d0f59a4309fed40e4fb26c7be42f1d4d55ccdcaaf7b4d445aa3122955

2 years agoEven tighter bounds on the maximum length of the filename for
drh [Sat, 25 Mar 2023 12:27:36 +0000 (12:27 +0000)] 
Even tighter bounds on the maximum length of the filename for
sqlite3_load_extension().

FossilOrigin-Name: 787291414d2d2082a3c63e7cdd6bec4719f0c8b75ad1355f5026932ecbb28ba8

2 years agoTighter constraints on the maximum length of the filename handed over
drh [Sat, 25 Mar 2023 03:17:08 +0000 (03:17 +0000)] 
Tighter constraints on the maximum length of the filename handed over
to sqlite3_load_extension(), due to
[forum:/forumpost/a43074729e|forum post a43074729e].  This is a
follow-on to [01f3877c7172d522] and
[forum:/forumpost/08a0d6d9bf|forum post 08a0d6d9bf].

FossilOrigin-Name: 9f351bdee2a09a4419bb8256a13d1f757b3e00ec26a445523f224fc56d9ae26d

2 years agoNew test case to further validate the fix at [221fdcec964f8317].
drh [Sat, 25 Mar 2023 02:07:20 +0000 (02:07 +0000)] 
New test case to further validate the fix at [221fdcec964f8317].
[forum:/forumpost/d34ad68c36|Forum post d34ad68c36].

FossilOrigin-Name: a6e218a6e1ddd74be6a313b1d336334071747efd4ecd354ed7efe303d09c849c

2 years agoFix CLI non-handling of OOM reported at [forum:/forumpost/6872514e04|Forum post 68725...
larrybr [Sat, 25 Mar 2023 01:29:40 +0000 (01:29 +0000)] 
Fix CLI non-handling of OOM reported at [forum:/forumpost/6872514e04|Forum post 6872514e04].

FossilOrigin-Name: 6f6a0fd63b13cb827d6a402de01a701eb5b3f92954032ea80e78ec864861a26c

2 years agoRemove undocumented, vestigial SQL functions in the CLI that were once used
drh [Fri, 24 Mar 2023 22:17:59 +0000 (22:17 +0000)] 
Remove undocumented, vestigial SQL functions in the CLI that were once used
for the ".recover" command but are now no longer needed.

FossilOrigin-Name: 1ef461aa4e95d254c2c1edebbbfd92ca96d752e04f68ebe70104e8d936d36be9

2 years agoFix possible integer overflow in bounds checking for the debugging function
drh [Fri, 24 Mar 2023 21:35:48 +0000 (21:35 +0000)] 
Fix possible integer overflow in bounds checking for the debugging function
"shell_int32()" found in the CLI.  This change does not affect the core
SQLite.  [forum:/forumpost/be9c294ee0|Forum post be9c294ee0].

FossilOrigin-Name: 6211471138a654641a4cf4831cfa3b470e06f29a2b77e4d58177c8e065bec11e

2 years agoFix an error in the OP_SeekScan opcode added by check-in [4a43430fd23f8835].
drh [Fri, 24 Mar 2023 21:24:52 +0000 (21:24 +0000)] 
Fix an error in the OP_SeekScan opcode added by check-in [4a43430fd23f8835].
Problem reported by [forum:/forumpost/8cc1dc0fe9|forum post 8cc1dc0fe9].

FossilOrigin-Name: 651a13fcd16f03e89eb6228c9f3250e25910b9bbe2637f627f65ff78f8ba2059

2 years agoFix the handling of indexed expressions in an outer query that appear as
drh [Fri, 24 Mar 2023 20:35:56 +0000 (20:35 +0000)] 
Fix the handling of indexed expressions in an outer query that appear as
corelated values inside an aggregate function within a subquery.
[forum:/forumpost/79cf371080|Forum post 79cf371080].

FossilOrigin-Name: d8259877eaa962e6f90675790d3770ef02bd1a5d86d319cd8c1834710df844c4

2 years agoFix a problem in cursor-hints for WITHOUT ROWID tables used in a RIGHT JOIN.
drh [Fri, 24 Mar 2023 19:17:25 +0000 (19:17 +0000)] 
Fix a problem in cursor-hints for WITHOUT ROWID tables used in a RIGHT JOIN.
[forum:/forumpost/591006b1cc|Forum post 591006b1cc].

FossilOrigin-Name: 221fdcec964f8317b2c23e926cc23799615cd3b4239a8a9ff87a83588d05bc64

2 years agoAdd a JS test which checks for the issue described in [forum post 895425b49a|forum...
stephan [Fri, 24 Mar 2023 17:15:15 +0000 (17:15 +0000)] 
Add a JS test which checks for the issue described in [forum post 895425b49a|forum:895425b49a].

FossilOrigin-Name: 98d30400e4721b1d48ff601698ced146052654f8c6de7c014d4d239bb2dbef43

2 years agoFix byte-code register allocation in ANALYZE for STAT4 when there multiple
drh [Fri, 24 Mar 2023 16:57:21 +0000 (16:57 +0000)] 
Fix byte-code register allocation in ANALYZE for STAT4 when there multiple
indexes with differing numbers of columns.
[forum:/forumpost/bc39e531e5|forum post bc39e531e5].

FossilOrigin-Name: 2bf5413dc2c19d5feb32e5b01aa9b990ec2f74f45f5ca0dca15215f8c9dbc9b9

2 years agoThe attempt to bring STAT4 up to 100% MC/DC at [55a26c67ed4a3a93] and
drh [Thu, 23 Mar 2023 10:54:07 +0000 (10:54 +0000)] 
The attempt to bring STAT4 up to 100% MC/DC at [55a26c67ed4a3a93] and
at [168fa2fb22b8c1ad] are incorrect.  Back them out and replace them with
a simple NEVER() macro.  Error reported by
[forum:/forumpost/dc4854437b|forum post dc4854437b].

FossilOrigin-Name: 5992370a89f8de7a6e941130b381f85d369856dbdb7860405e6fb17dad2293df

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