drh [Wed, 6 Mar 2024 14:30:42 +0000 (14:30 +0000)]
Add the json_pretty(J) function for pretty-printing of JSON. An optional
2nd argument is text used for indentation, with a default value being four
spaces.
drh [Tue, 5 Mar 2024 16:47:48 +0000 (16:47 +0000)]
The value returned by the json_each.json field needs to survive longer than
the json_each virtual table itself, in the event that the value is used in
an aggregate expression. dbsqlfuzz 5120bd0b3bb0b73eebbcb79ac37c6b0663fccad6
stephan [Tue, 5 Mar 2024 12:48:26 +0000 (12:48 +0000)]
/fiddle: reorder/replace example entries to make them more coherent when tried in order and clear the example selection list when the input area is cleared, both based on forum feedback.
stephan [Tue, 5 Mar 2024 06:31:37 +0000 (06:31 +0000)]
/fiddle: before resetting a db, roll back any transactions (resolves problem reported in [forum:0b41a25d65|forum post 0b41a25d65]) and remove an obsolete/broken reference to a long-gone API which could cause initialization to fail prematurely.
drh [Mon, 4 Mar 2024 13:58:09 +0000 (13:58 +0000)]
Adjust date/time functions so that they do a better job of keeping track
of whether the current time is UTC or localtime, and no-op the 'utc' and
'localtime' modifiers accordingly. See
[forum:/info/e7a939e074|forum post e7a939e074].
Also add the datedebug() function, available
only under -DSQLITE_DEBUG, for improved visibility of the DateTime object
during debugging and testing.
stephan [Mon, 4 Mar 2024 09:56:47 +0000 (09:56 +0000)]
Document why the wasm build does not use Emscripten's -sSTRICT=1 flag and account for a behaviour change in emsdk 3.1.55 regarding the HEAPxyz symbols.
stephan [Mon, 4 Mar 2024 09:23:52 +0000 (09:23 +0000)]
When warning about multiple invocations of JS's sqlite3ApiBootstrap(), use the warning logger installed by the first invocation, rather than console.warn.
stephan [Mon, 4 Mar 2024 06:54:41 +0000 (06:54 +0000)]
After wasm bootstrapping has read the optional global-scope config objects, delete those objects because any further changes would not have any useful effect. Expand the docs regarding the sqlite3ApiBootstrap() config object and explain the necessary evil of a separate global-scope object for that configuration.
drh [Sat, 2 Mar 2024 21:02:41 +0000 (21:02 +0000)]
New date/time modifiers "mnth" and "yr" work like "month" and "year" but
resolve day-of-month overflow by truncating rather than rolling over into
the next month. [forum:/forumpost/232d1abb5d|Forum thread 232d1abb5d]
drh [Sat, 2 Mar 2024 13:38:46 +0000 (13:38 +0000)]
Proof-of-concept for new time-interval operator "pg-month" and "pg-year" that
use the truncate-to-month algorithm for month overflow instead of the
wrap-to-next-month algorithm that is used by SQLite by default.
stephan [Tue, 27 Feb 2024 11:02:31 +0000 (11:02 +0000)]
Extend sqlite3.c makefile rule to support EXTRA_SRC=list-of-c-files to append to the generated sqlite3.c, as discussed in/around [forum:ccda88cf6f1754c5|forum post ccda88cf6f1754c5].
drh [Mon, 26 Feb 2024 15:27:33 +0000 (15:27 +0000)]
When inserting a 3-byte cell into a btree, ensure that the extra padding byte
is 0x00. This is not necessary for security, as far as I can tell, but it
seems like a reasonable precaution.
drh [Sun, 25 Feb 2024 21:30:33 +0000 (21:30 +0000)]
Make sure key comprisons are done correctly if the index key contains NaN
values that have not been shifted into NULLs. That can only happen due to
database corruption, but we need to deal with it nevertheless.
drh [Tue, 20 Feb 2024 12:48:00 +0000 (12:48 +0000)]
Enhancements to PRAGMA optimize and ANALYZE. Add the 0x10000 flag to
PRAGMA optimize. ANALYZE now records zero-size partial indexes in the
sqlite_stat1 table. PRAGMA optimize looks for both growth and shrinkage
in table sizes, and uses tighter bounds (10x rather than 25x) to trigger
a re-analyze. PRAGMA optimize automatically uses are reasonable
analysis_limit to prevent excessive runtimes.
drh [Mon, 19 Feb 2024 16:22:58 +0000 (16:22 +0000)]
If a table has one or more rows and it has a partial index has zero rows,
still make an entry in the sqlite_stat1 table for the partial index, so that
we know that "PRAGMA optimize" does not need to redo the whole table.
drh [Mon, 19 Feb 2024 13:50:09 +0000 (13:50 +0000)]
Simplifications to PRAGMA optimize to make it easier to use. It always
tries to ANALYZE unanalyzed indexes. The 0x10000 flag just makes it check
for size changes in all tables.
drh [Mon, 19 Feb 2024 13:06:27 +0000 (13:06 +0000)]
Change the 0x20000 bit (use analysis limit) to 0x10, meaning that this feature
is on by default. The default analysis limit is changed to 2000 which is
almost always sufficient for accurate analysis results.
stephan [Mon, 19 Feb 2024 12:20:46 +0000 (12:20 +0000)]
Extend the strerror_r() result type discrepancy check in os_unix.c to include the Android NDK, as reported in [forum post 3f13857fa4062301|forum:3f13857fa4062301]. The NDK's strerror_r() signature is version-dependent, whereas this change assumes int return (POSIX semantic) across all versions.
drh [Sat, 17 Feb 2024 03:32:31 +0000 (03:32 +0000)]
Fix rounding in zero-precision %f and %g printf conversions.
[forum:/info/393708f4a8|Forum post 393708f4a8]. This bug was
introduced by check-in [32befb224b254639] and first appeared in version 3.43.0.
drh [Fri, 16 Feb 2024 21:30:08 +0000 (21:30 +0000)]
Fix the subtype on the value column from json_each/json_tree for cases
when the value is an array or object. Fix for the bug reported by
[forum:/forumpost/ecb94cd210|forum post ecb94cd210].
drh [Tue, 13 Feb 2024 18:41:46 +0000 (18:41 +0000)]
Fix a bug in PRAGMA integrity_check introduced by enhancement (8a) in
[https://sqlite.org/releaselog/3_42_0.html|release 3.42.0] and first reported by
[forum:/forumpost/ee4f6fa5ab|forum post ee4f6fa5ab].
drh [Tue, 13 Feb 2024 17:11:19 +0000 (17:11 +0000)]
Changes to vtabCallConstructor() to avoid a harmless static analyzer warning
and to help prove that the UAF reported by
[forum:/forumpost/cafbe582e8|forum post cafbe582e8] is a false-positive.
drh [Sun, 11 Feb 2024 20:53:14 +0000 (20:53 +0000)]
If a term of an ORDER BY or GROUP BY contains an aggregate function or column,
then it is not an alias that needs to be resolved, so don't try to. This fixes
a harmless assertion found by dbsqlfuzz. This yet another problem that
orginated at check-in [6e6b3729e0549de0].