]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
2 years agoMore off-by-one errors in the new JSON parsing. json-nan-inf
drh [Sun, 2 Apr 2023 20:46:24 +0000 (20:46 +0000)] 
More off-by-one errors in the new JSON parsing.

FossilOrigin-Name: dbc99662087b63c9ed5b398535a6091fc2c5e507907dd1fcb7ad0b6ab3f17144

2 years agoFix an off-by-one error in the recognition of -Infinity.
drh [Sun, 2 Apr 2023 20:27:02 +0000 (20:27 +0000)] 
Fix an off-by-one error in the recognition of -Infinity.

FossilOrigin-Name: f7ebf3e6286ddc8cdaa9446235407785d1be2be2d9992e21ef59fcd655f68432

2 years agoAllow special floating-point value names in JSON: "inf", "-inf", "infinity",
drh [Sat, 1 Apr 2023 23:29:59 +0000 (23:29 +0000)] 
Allow special floating-point value names in JSON:  "inf", "-inf", "infinity",
"-infinity", "nan", "qnan", and "snan".  All are converted into valid JSON
values: 9e999, -9e999, or null.  Requires the SQLITE_ENABLE_JSON_NAN_INF
compile-time option to operate.

FossilOrigin-Name: fc8793e5acac7351749e360c6bace5d5a8b3de3aa600ae23e260557db650c461

2 years agoFix harmless compiler warnings.
drh [Sat, 1 Apr 2023 15:51:21 +0000 (15:51 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: a4fb2864fe01cce9694242a0750623ca47fcecd68f74c4239d3eb5fbf978770a

2 years agoImproved error messages from PRAGMA integrity_check. Identify the root of
drh [Sat, 1 Apr 2023 13:14:53 +0000 (13:14 +0000)] 
Improved error messages from PRAGMA integrity_check.  Identify the root of
the tree when a problem is found in a b-tree, making it easier to track the
problem to a specific table or index.

FossilOrigin-Name: a1cb152e69c7c6cdd99300c91a8104716089de459d9d19e33ef38432aad70908

2 years agoIn the b-tree module use %u instead of %d to print unsigned quantities such
drh [Sat, 1 Apr 2023 12:22:57 +0000 (12:22 +0000)] 
In the b-tree module use %u instead of %d to print unsigned quantities such
as page numbers and offsets.

FossilOrigin-Name: 33ac62d8eec56eb71f20ccd28a5d6e4e8051522feb2db0199abee9e18ce1f64e

2 years agoOmit the the count-of-view optimization if there is a HAVING clause.
drh [Fri, 31 Mar 2023 23:48:59 +0000 (23:48 +0000)] 
Omit the the count-of-view optimization if there is a HAVING clause.
dbsqlfuzz 6a107e3055bd22afab31cfddabc2d9d54fcbaf69

FossilOrigin-Name: babe2b5e59647ac9db4601e67c25190aac14eb76d5fcb9fa5b3692b955fefd61

2 years agoEarlier error detection for index expression usage by aggregate functions.
drh [Thu, 30 Mar 2023 19:05:48 +0000 (19:05 +0000)] 
Earlier error detection for index expression usage by aggregate functions.
dbsqlfuzz 29214ace4e25c98d2ddff8fbcf97afdda23f28b9

FossilOrigin-Name: 8e841e7f025f7205959453875f2d9db36271642045593970a2b2fc20b2f847c3

2 years agoOmit a branch that is no longer needed following [c9c4f287652933eb].
drh [Thu, 30 Mar 2023 16:08:54 +0000 (16:08 +0000)] 
Omit a branch that is no longer needed following [c9c4f287652933eb].

FossilOrigin-Name: 960a488a2db92f5437bc8171cdbed44618d9381c57fd41b2f0e357b6012c80b5

2 years agoFix an error in new test script test/aggfault.test.
dan [Thu, 30 Mar 2023 12:19:38 +0000 (12:19 +0000)] 
Fix an error in new test script test/aggfault.test.

FossilOrigin-Name: 8724fe7426da55d19dba7b30e09321ba30c73286513864cb05de32f72e50ee31

2 years agoFix a crash that could follow an OOM error while processing aggregate functions.
dan [Thu, 30 Mar 2023 11:05:36 +0000 (11:05 +0000)] 
Fix a crash that could follow an OOM error while processing aggregate functions.

FossilOrigin-Name: 804435a2731bd3c26278c47098854b9ee7727a686587f6208e793738fbfc0555

2 years agoAvoid having OP_SeekScan jump over an OP_IdxGT or OP_IdxGE that follows the OP_SeekGE...
dan [Wed, 29 Mar 2023 21:58:06 +0000 (21:58 +0000)] 
Avoid having OP_SeekScan jump over an OP_IdxGT or OP_IdxGE that follows the OP_SeekGE opcode. Fix for [b50528af4468237c].

FossilOrigin-Name: c9c4f287652933eb6262a3419efe7e7288f55d3db7e2ac032eeae025f665d306

2 years agoFix a problem with sqlite3_stmt_scanstatus() from within an SQLITE_TRACE_STMT callbac...
dan [Wed, 29 Mar 2023 18:54:01 +0000 (18:54 +0000)] 
Fix a problem with sqlite3_stmt_scanstatus() from within an SQLITE_TRACE_STMT callback made from within a trigger.

FossilOrigin-Name: 1fa78fafa1340de458546526b03cf8b3e9c823913c4225d7c747ad182df5c0fc

2 years agoAnother #ifdef to omit code that is only used by STAT4.
drh [Wed, 29 Mar 2023 15:16:29 +0000 (15:16 +0000)] 
Another #ifdef to omit code that is only used by STAT4.

FossilOrigin-Name: 445c75567de9bf9c8075dfc62c60dc4abeefab59c7803a5ef2cc5d69c08d7633

2 years agoNew #ifdefs to omit code that is unused except under STAT4.
drh [Wed, 29 Mar 2023 14:42:11 +0000 (14:42 +0000)] 
New #ifdefs to omit code that is unused except under STAT4.

FossilOrigin-Name: 09a9b30ba7828a487a33a3ebf8028dfaa147dff67d2724584123b90a88d9814b

2 years agoEnhance PRAGMA integrity_check so that it can detect that a NOT NULL column
drh [Wed, 29 Mar 2023 11:36:24 +0000 (11:36 +0000)] 
Enhance PRAGMA integrity_check so that it can detect that a NOT NULL column
contains a NaN value and report that as an error.
dbsqlfuzz f144b642fe6f1a1c196f258ac6e60118a0cb59b2.

FossilOrigin-Name: 7638d9755dc90fd353b874d03ed418fa8aaee4440290ff69b1b552eae84e5baa

2 years agoFix a weird corner case in aggregate function processing that results from the
drh [Tue, 28 Mar 2023 16:02:28 +0000 (16:02 +0000)] 
Fix a weird corner case in aggregate function processing that results from the
recent addition of support for index expressions on aggregate queries.
[forum:/forumpost/bad532820c|Forum post bad532820c].

FossilOrigin-Name: c34fd9fe1b76e0a5943f014f46141cbe55d41bb1e6980adf9bcb6785a03e7883

2 years agoFix multiple problems with RETURNING on a DML statement against a view,
drh [Tue, 28 Mar 2023 11:18:04 +0000 (11:18 +0000)] 
Fix multiple problems with RETURNING on a DML statement against a view,
all inspired by [forum:/forumpost/dc3b92cfa0|forum post dc3b92cfa0].
(1) Do not allow a RETURNING clause to trick the code generator into thinking
that the view being updated has an INSTEAD OF trigger.
(2) Generate all result columns for a view in a DML statement.
(3) The automatic covering index for a view should cover all result columns
of the view.

FossilOrigin-Name: c8bedef0d61731c29ae34de1594222d15b578f9e2cddbbd5b74fb3059644fe0f

2 years agoRemove a meaningless JS test. Add a timer to the OPFS async-side worker loader in...
stephan [Mon, 27 Mar 2023 13:57:08 +0000 (13:57 +0000)] 
Remove a meaningless JS test. Add a timer to the OPFS async-side worker loader in an attempt to catch a browser-specific quirk in which the worker loading silently fails, per discussion in/around [forum post a708c98dcb3ef|forum:a708c98dcb3ef].

FossilOrigin-Name: 4fc1904b8e18c7d41fa65490ced125f1df4f0c22c13de957b24615ed09b3ecb7

2 years agoDo not allow constant factoring during PRAGMA integrity_check, since the
drh [Mon, 27 Mar 2023 13:24:02 +0000 (13:24 +0000)] 
Do not allow constant factoring during PRAGMA integrity_check, since the
constants might be stored in registers that are later reused for other
purposes.  dbsqlfuzz dc9ab26037cf5ef797d28cd1ae0855ade584216d.  Problem
discovered by a new assert() statement added in [6f8b97f31a4c8552].

FossilOrigin-Name: 0bba27b78112b2b2271e498f41c437df985aa2faab302ee5b29d9b60003a8379

2 years agoImprovements to register allocation, especially in the ANALYZE command.
drh [Sun, 26 Mar 2023 16:36:27 +0000 (16:36 +0000)] 
Improvements to register allocation, especially in the ANALYZE command.
New assert() statements added to help verify that memory allocation is
correct, and to help fuzzer find lingering errors.

FossilOrigin-Name: 6f8b97f31a4c8552312b4c98432ea356ae54c06d9cc929969f50c3c88360cd7b

2 years agoDisable factoring of constant values during ANALYZE. This is a temporary
drh [Sun, 26 Mar 2023 11:54:51 +0000 (11:54 +0000)] 
Disable factoring of constant values during ANALYZE.  This is a temporary
fix for [forum:/forumpost/07de5f6216|forum post 07de5f6216].  The register
allocation logic in ANALYZE needs to be completely refactored, but that will
take longer.  This check-in will serve to resolve the issue until a better
fix can be devised.

FossilOrigin-Name: c3967d1259f1df969d303394986960bd098e174dcd337e374c9c3c39e0efa466

2 years agoWhen the left table of a RIGHT JOIN is used inside an aggregate function and the...
drh [Sat, 25 Mar 2023 23:52:05 +0000 (23:52 +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. Fix for
[forum:/forumpost/9b491e1deb|forum post 9b491e1deb].

FossilOrigin-Name: ffe23af73fcb324df988a00be343654ce7078b7208647c4eb779d666b8297e7c

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 reading sqlite_stat4 data during query planning, be sure to expand
drh [Sat, 25 Mar 2023 22:37:23 +0000 (22:37 +0000)] 
When reading sqlite_stat4 data during query planning, be sure to expand
zeroblobs prior to running comparisons.  Fix for the issue identified
by [forum:/forumpost/5275207102|forum post 5275207102].

FossilOrigin-Name: 5c8dd8dfcaab9c364b3a126ca35880ef57f5cecbe030771e646c934c8cf43709

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