drh [Fri, 21 Jan 2022 16:41:11 +0000 (16:41 +0000)]
When computing a vector to be used as a key for an index lookup, do not
check for NULL values and abort until after all key values have been
computed, in case one of the later key values involves some initialization
that is needed by a LEFT JOIN. Fix for the problem identified by
[forum:/forumpost/ab95010d410a0a55|Forum post ab95010d410a0a55].
drh [Fri, 21 Jan 2022 01:00:53 +0000 (01:00 +0000)]
Add the sqlite3_vtab_rhs_value() interface, allowing the xBestIndex method
of a virtual table to access known values on the right-hand side of
constraint expressions.
drh [Thu, 20 Jan 2022 02:04:53 +0000 (02:04 +0000)]
Fix the ability to read read-only WAL-mode database when -shm is present,
([00ec95fcd02bb415|check-in 00ec95fcd02bb415]) so that it works
for the case of 64K page size.
drh [Mon, 17 Jan 2022 23:37:25 +0000 (23:37 +0000)]
Allow an "IntReal" value to count as a REAL when checking types for
insertion into a generated column on a STRICT table.
[forum:/forumpost/fa012c77796d9399|Forum post fa012c77796d9399].
drh [Mon, 17 Jan 2022 15:23:57 +0000 (15:23 +0000)]
Fix incorrect testcase() and assert() macros in json.c. They were not causing
problems. The assert() was simply unreachable. The testcase() added an
unreachable condition.
drh [Mon, 17 Jan 2022 14:42:38 +0000 (14:42 +0000)]
Never allow the b-tree layers view of the number of pages in the database
file exceed the actual number of pages in the database file, even when
PRAGMA writeable_schema=ON. This helps with earlier detection of corruption,
and prevents excess memory usage and CPU cycles in some integrity_check ops.
drh [Wed, 12 Jan 2022 20:31:14 +0000 (20:31 +0000)]
When the result of a subquery is to be stored in a register and that
subquery has an ORDER BY clause and an OFFSET, NULL out the destination
register before starting the ORDER BY so that the register will be set
correctly even if the OFFSET is larger than the number of output rows.
Fix for the problem reported in
[forum:/forumpost/0ec80f12d02acb3f|forum post 0ec80f12d02acb3f].
drh [Fri, 7 Jan 2022 17:08:48 +0000 (17:08 +0000)]
New json_nextract() function that works like json_extract() except that it
returns NULL instead of raising an error if the first argument is not
well-formed JSON. Or if the first argument is not well-formed JSON and
the second argument is '$', then return the first argument quoted. The
"->" and "->>" operators are converted to use json_nextract().
drh [Fri, 7 Jan 2022 16:03:00 +0000 (16:03 +0000)]
Add the json_ntype() SQL function. Works like the 1-argument json_type()
except that it returns NULL if the argument is not well-formed JSON, rather
than raising an error.
drh [Fri, 7 Jan 2022 14:58:47 +0000 (14:58 +0000)]
Add new binary operators "->" and "->>" to the parser that evaluate to
2-argument SQL functions by the same name. Add new "->" and "->>" functions
to the JSON extension that are aliases for json_extract().
drh [Sun, 2 Jan 2022 19:32:43 +0000 (19:32 +0000)]
Do not open a rollback journal file when the journal_mode is OFF, even if
such a file exists on disk. See
[forum/forumpost/ec2a102440|forum post ec2a102440] for a description. I so
far have been unable to find any harm to come of the problem, other than the
assertion fault when in DEBUG mode.
drh [Sun, 2 Jan 2022 12:01:03 +0000 (12:01 +0000)]
Clear the cache of triggers used to implement CASCADE foreign key constraints
whenever the schema changes. Fix for the problem identified by
[forum:/forumpost/2831335356|forum post 2831335356].
drh [Sat, 1 Jan 2022 22:55:31 +0000 (22:55 +0000)]
Do not raise an SQLITE_SCHEMA error if in sqlite3Init(). Fix for PoC #2 in
[forum:/forumpost/b03d86f951|forum post b03d86f951]. See TH3 for test
cases.
drh [Sat, 1 Jan 2022 17:21:55 +0000 (17:21 +0000)]
Remove an obsolete assert() statement that no longer does anything useful
and which is not always true. Fix for PoC #1 of
[forum:/forumpost/b03d86f951|forum post b03d86f951].
drh [Sat, 1 Jan 2022 12:26:01 +0000 (12:26 +0000)]
Fix a faulty assert() statement - adding a CORRUPT_DB term - based on a test
case derived from [562805cf488a455c]. Also add a test case to that prior
issue.
drh [Fri, 31 Dec 2021 16:37:46 +0000 (16:37 +0000)]
Move the pTriggerPrg and pCleanup elements of the Parse object up into the
section of that object that is persisted across calls to sqlite3NestedParse().
This fixes a memory leak
[forum:/info/24bd1fef7e9323ef|reported in forum post 24bd1fef7e9323ef].
drh [Thu, 30 Dec 2021 17:36:54 +0000 (17:36 +0000)]
When constructing the sqlite3_index_info object for the xBestIndex method
of a virtual table, omit constant trims from the ORDER BY clause, as they
will always be in the correct order.
drh [Thu, 30 Dec 2021 02:38:43 +0000 (02:38 +0000)]
When a table has an INTEGER PRIMARY KEY ON CONFLICT REPLACE and some other
uniqueness constraint, and it participates in an upsert on that other
constraint, ensure that code that checks for conflicts on the INTEGER PRIMARY
KEY is well-formed. Fix for the problem reported by
[forum:/forumpost/06b16b8b29f8c8c3|forum post 06b16b8b29f8c8c3].
drh [Wed, 29 Dec 2021 13:32:36 +0000 (13:32 +0000)]
Minor changes to shell1.test test results to account for the new feature
of the shell that points to the specific part of the input line where the
error occurs.
drh [Fri, 24 Dec 2021 13:30:22 +0000 (13:30 +0000)]
Raise an error if a schema name is attached to the table-alias name of a
subquery or view. See
[forum:/forumpost/021a33600b|forum post 021a33600b] for the bug report.
drh [Thu, 23 Dec 2021 00:16:06 +0000 (00:16 +0000)]
Reduce the size of the compiled binary by a couple of hundred bytes by
using a thigher packing of a transformation table in date.c.
Suggested by [forum:/forumpost/4f6efbb2a9|forum post 4f6efbb2a9].
drh [Mon, 20 Dec 2021 23:46:44 +0000 (23:46 +0000)]
In the json1 extension, which compiling it separately, ensure that either
SQLITE_DEBUG macro or the NDEBUG macro is set prior to including assert.h.
If neither macro is defined, then assert() statement do generate code but
VVA() statements do not, and that is a deadly combination.
[forum:/forumpost/858dee399e|forum post 858dee399e]