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]
drh [Tue, 14 Dec 2021 20:13:28 +0000 (20:13 +0000)]
Enhance the virtual table query planner so that it is able to deal with
ORDER BY terms that contain COLLATE clauses as long as the specified
collation matches the virtual table. This is especially important for
UNION ALL since a "COLLATE binary" is added to ORDER BY clauses if no
COLLATE clause exists in the original SQL.
drh [Sat, 11 Dec 2021 17:10:58 +0000 (17:10 +0000)]
Do not allow early evaluation of Bloom filters that use the IN operator as
the machinery to deal with the IN operator is not available.
dbsqlfuzz 5b51c247518278f79a45cea978702e86e86cd4f9.
drh [Fri, 10 Dec 2021 17:36:16 +0000 (17:36 +0000)]
Rename the internal routine constructBloomFilter() to
sqlite3ConstructBloomFilter(). OSSFuzz is reporting a crash with a garbled
stack that we cannot reproduce. Perhaps the original "constructBloomFilter()"
name is colliding with some internal name used by OSSFuzz. We'll see if this
rename clears the problem.
drh [Thu, 9 Dec 2021 14:09:47 +0000 (14:09 +0000)]
Do not attempt to reprepare a prepared statement that returns SQLITE_SCHEMA
if there was an OOM. This enhancement supercedes check-in
[fee469925231d074].
drh [Wed, 8 Dec 2021 16:07:22 +0000 (16:07 +0000)]
In the WhereClause object, do not assume that all TERM_VIRTUAL terms appear
at the end of the list, because that is no longer true. Instead, keep a
separate nBase count that is the size of the list excluding the tail of
virtual terms. Use nBase instead of nTerm when scanning terms that are not
virtual. Add assert()s to validate correctness of WhereClause.
drh [Mon, 6 Dec 2021 20:16:53 +0000 (20:16 +0000)]
Omit the OP_FilterInit opcode. Use OP_Blob to initialize each Bloom filter
instead. Size the Bloom filter based on sqlite_stat1 size estimates rather
than a run-time measurement for improved testability.
drh [Mon, 6 Dec 2021 15:40:24 +0000 (15:40 +0000)]
Do not allow SQLITE_LIMIT_LENGTH to be set lower than 1 as an
SQLITE_LIMIT_LENGTH of 0 causes lots of unnecessary problems for
users of the sqlite3_str object.