drh [Sun, 24 Mar 2024 21:18:03 +0000 (21:18 +0000)]
Fix the xBestIndex method of the pragma virtual table so that it correctly
gives a higher cost to plans where the schema hidden parameter is
unconstrained.
drh [Sun, 24 Mar 2024 19:08:05 +0000 (19:08 +0000)]
Fix the SQLITE_ALLOW_ROWID_IN_VIEW bug-compatibility option so that it works
again. Add the SQLITE_CONFIG_ROWID_IN_VIEW sqlite3_config() value to
optionally disable the bug-compatibility mode at start-time.
Enable testing of SQLITE_ALLOW_ROWID_IN_VIEW.
mistachkin [Wed, 6 Mar 2024 20:58:08 +0000 (20:58 +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.
mistachkin [Wed, 6 Mar 2024 20:56:52 +0000 (20:56 +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.
mistachkin [Wed, 6 Mar 2024 20:55:44 +0000 (20:55 +0000)]
Rig sqlite3_serialize() so that it will initialize a previously uninitialized database prior to serializing it, so that it does not have a zero-byte size and does not return NULL (except for OOM). [forum:/forumpost/498777780e16880a|Forum thread 498777780e16880a].
mistachkin [Wed, 6 Mar 2024 20:54:38 +0000 (20:54 +0000)]
When doing a text-affinity comparison between two values where one or both have both a text and a numeric type, make sure the numeric type does not confuse the answer. This is a deeper fix to the problem observed by [forum:/forumpost/3776b48e71|forum post 3776b48e71]. The problem bisects to [25f2246be404f38b] on 2014-08-24, prior to version 3.8.7.
mistachkin [Wed, 6 Mar 2024 20:52:38 +0000 (20:52 +0000)]
Ensure that the replace() SQL function always returns a TEXT value even when its first argument is numeric and its second argument is an empty string. Fix for the issue reported by [forum:/forumpost/3776b48e71|forum post 3776b48e71].
drh [Tue, 5 Mar 2024 16:59:00 +0000 (16:59 +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
drh [Tue, 6 Feb 2024 13:36:29 +0000 (13:36 +0000)]
Return SQLITE_ABORT if the underlying shadow tables change in the middle of an rtree query in such a way as to invalidate an rtree internal priority queue entry. This replaces the SQLITE_ABORT_ROLLBACK mechanism added in [97cffff331b].
drh [Mon, 29 Jan 2024 12:58:12 +0000 (12:58 +0000)]
When rendering JSONB back into text JSON, report an error if a zero-length
integer or floating-point node is encountered. Otherwise, if the node occurs
at the very end of the JSONB, the rendering logic might read one byte past
the end of the initialized part of the BLOB byte array. OSSFuzz 66284.
drh [Tue, 23 Jan 2024 16:17:00 +0000 (16:17 +0000)]
In os_unix.c and os_win.c, do not allow xFetch() to return a pointer to a page buffer that is right at the end of the mapped region - if the database is corrupted in a specific way such a page buffer might be overread by several bytes.
drh [Tue, 23 Jan 2024 13:53:45 +0000 (13:53 +0000)]
When a JSON input is a blob, but it looks like valid JSON when cast to text,
then accept it as valid JSON. This replicates a long-standing bug in the
behavior of JSON routines, and thus avoids breaking legacy apps.
stephan [Tue, 16 Jan 2024 14:28:59 +0000 (14:28 +0000)]
wasm build: reformulate an awk invocation to account for awks which do not support the -e flag. Problem reported on the forum via a docker-hosted build.
dan [Thu, 11 Jan 2024 14:03:08 +0000 (14:03 +0000)]
In fts5, flush the contents of the in-memory hash table whenever the secure-delete option is toggled. This prevents spurious corruption reports under some circumstances.
drh [Tue, 9 Jan 2024 23:15:46 +0000 (23:15 +0000)]
Put an SQLITE_ENABLE_SETLK_TIMEOUT branch inside the appropriate ifdef with
an assert on the else since the condition is always false if SETLK_TIMEOUT
is not available.
dan [Mon, 8 Jan 2024 19:55:40 +0000 (19:55 +0000)]
Automatically turn off DEFENSIVE mode in the shell tool when executing scripts generated by the ".dump" command against an empty database. Add a warning to the top of generated ".dump" scripts that populate virtual tables.
dan [Mon, 8 Jan 2024 18:46:34 +0000 (18:46 +0000)]
Automatically turn off DEFENSIVE mode in the shell tool when executing scripts generated by the ".dump" command against an empty database. Add a warning to the top of generated ".dump" scripts that populate virtual tables.
dan [Mon, 8 Jan 2024 13:38:15 +0000 (13:38 +0000)]
Ensure that SQLITE_PROTOCOL is not returned too early when a SQLITE_ENABLE_SETLK_TIMEOUT build fails to open a transaction on a wal mode database in cases where blocking locks are not being used.
dan [Sat, 6 Jan 2024 19:16:54 +0000 (19:16 +0000)]
Ensure that SQLITE_PROTOCOL is not returned too early when a SQLITE_ENABLE_SETLK_TIMEOUT build fails to open a transaction on a wal mode database in cases where blocking locks are not being used.
drh [Wed, 3 Jan 2024 12:26:02 +0000 (12:26 +0000)]
Update the sqldiff.exe utility program so that it uses the sqlite3_str
string interface, and so that it does console output using the
ext/consio extension.
drh [Mon, 1 Jan 2024 17:58:57 +0000 (17:58 +0000)]
Remove some unnecessary computations from ANALYZE so that ANALYZE runs with
fewer CPU cycles. These changes were spotted while working on the nearby
enhanced-stat1 branch. So even if enhanced-stat1 is abandoned, that effort
put into it will not have been in vain.
drh [Mon, 1 Jan 2024 17:48:02 +0000 (17:48 +0000)]
Extra steps taken to avoid using low-quality indexes in a query plan.
This branch accomplishes the same end as the nearby enhanced-stat1 branch,
but with much less change and hence less risk.