drh [Mon, 25 Mar 2019 21:56:26 +0000 (21:56 +0000)]
In the CLI, code the "sqlite_parameters" name directly rather than using a
macro, for clarity of presentation for users who are reading the code for
the purpose of seeing how the CLI implements parameter binding.
drh [Mon, 25 Mar 2019 21:35:41 +0000 (21:35 +0000)]
Change the name of the parameter table in the CLI to "sqlite_parameters".
Doing so involves adding SQLITE_DBCONFIG_WRITABLE_SCHEMA and allowing the
creation of tables whose names begin with "sqlite_" and that are indexed
while writable_schema is on.
drh [Mon, 25 Mar 2019 18:44:08 +0000 (18:44 +0000)]
Fix a faulty assert() statement in balance_nonroot() - the assert() should use
get2byteNotZero() instead of get2byte() for the corner case where the
number cells is zero on a 65536-byte page.
drh [Mon, 25 Mar 2019 15:06:16 +0000 (15:06 +0000)]
Fix the writefile() SQL function implemented by ext/misc/fileio.c such that
any directories created have standard umask permissions, not permissions
of the file that is to be written.
drh [Mon, 25 Mar 2019 14:24:19 +0000 (14:24 +0000)]
For the ".archive --update" command in the CLI, only update files if their
mtime or mode has changed. To force an update, use the new --insert instead.
drh [Fri, 22 Mar 2019 13:53:25 +0000 (13:53 +0000)]
We learn that readdir_r() is deprecated in favor of plain old readdir(), which
is now suppose to be threadsafe using thread-local storage. So remove the
use of readdir_r() from the test code. (SQLite itself never calls readdir()
or readdir_r()).
dan [Wed, 20 Mar 2019 16:58:21 +0000 (16:58 +0000)]
Fix a potential dangling pointer deference in an ALTER TABLE run on a schema that contains constructs of the form "PRIMARY KEY(column COLLATE collation)".
drh [Wed, 20 Mar 2019 11:16:09 +0000 (11:16 +0000)]
Enhance the rtreenode() function of rtree (used for testing) so that it
uses the newer sqlite3_str object for better performance and improved
error reporting.
drh [Tue, 19 Mar 2019 15:36:46 +0000 (15:36 +0000)]
When computing the amount of scratch memory needed during a rebalance operation,
assume the worst case for the number of cells per page, rather than relying
on the BtPage.nCell value, which might be incorrect for a corrupt database.
dan [Tue, 12 Mar 2019 09:49:10 +0000 (09:49 +0000)]
Fix a crash that could occur if the RHS of an IN expression is a correlated sub-query that refers to the outer query from within a window frame definition only.
drh [Fri, 8 Mar 2019 01:52:30 +0000 (01:52 +0000)]
Detect an attempt to drop a btree that is not within the bounds of the
database file and abort early with an SQLITE_CORRUPT error, to avoid
problems later on in the process.
drh [Wed, 6 Mar 2019 14:08:41 +0000 (14:08 +0000)]
Add an "|| CORRUPT_DB" term to an assert() that might be false if the database
is corrupt. Also add a branch to have sqlite3PagerMovepage() return
SQLITE_CORRUPT in that case.
drh [Tue, 5 Mar 2019 14:39:00 +0000 (14:39 +0000)]
If the initial byte of a record is a large value, then always used the
generalized record comparison routine sqlite3VdbeRecordCompare() rather than
one of the specialized versions that are optimized for shorter records.
drh [Fri, 1 Mar 2019 18:07:05 +0000 (18:07 +0000)]
In a query that uses a partial index, the expression that is the WHERE clause
of the partial index must always be true. Use this fact to avoid evaluating
identical terms in the WHERE clause of the query.
drh [Sat, 23 Feb 2019 00:21:00 +0000 (00:21 +0000)]
Check-in [fa792714ae62fa98] is incorrect. Add a test case to refute it and
also a fix to make it right.
Then add an alternative fix to ticket [df46dfb631f75694] in which
all ephemeral tables used as the RHS of an IN operator be index btrees
and never table btrees so that they can always be reused.
drh [Fri, 22 Feb 2019 23:29:56 +0000 (23:29 +0000)]
Make all ephemeral tables built to hold the RHS of an IN operator be
index-btrees, never table-btrees, regardless of whether or not they are
used as IN_INDEX_LOOP or IN_INDEX_MEMBERSHIP. That way, the same ephmerial
table can be reused for both cases.
drh [Fri, 22 Feb 2019 21:33:56 +0000 (21:33 +0000)]
Check-in [fa792714ae62fa980] is not a valid fix for ticket
[df46dfb631f75694], as the new test case in this check-in demonstrates.
The fix here causes test cases for the [df46dfb631f75694] bug to fail
again, so this check-in is on a branch. A new fix is needed for
[df46dfb631f75694].
dan [Fri, 22 Feb 2019 19:24:16 +0000 (19:24 +0000)]
Internally, remove all references to a Window object that belongs to an expression in an ORDER BY clause if that expression is converted to an alias of a result-set expression. Fix for [4feb3159c6].
drh [Thu, 21 Feb 2019 16:41:34 +0000 (16:41 +0000)]
Detect oversized strings in the OP_String opcode even if the P4 argument
is originally UTF8 and has to be converted to UTF16 to match the database
file and that conversion causes the string to become shorter and cross
below SQLITE_LIMIT_LENGTH threshold. This might fix an OSSFuzz problem
that we have been so far unable to reproduce.
drh [Wed, 20 Feb 2019 13:55:45 +0000 (13:55 +0000)]
Progress handler improvements:
(1) Invoke the callback after OP_Program opcodes
(2) Invoke the callback multiple times in a row to catch up after a
long run of no progress checks.
drh [Wed, 20 Feb 2019 12:52:47 +0000 (12:52 +0000)]
When an IN operator drives a query loop, mark it as "CODED" so that it
will not be used afterwards for a (pointless) membership test. This is
a better fix for ticket [df46dfb631f75694] than the previous fix that is
now on a branch as it preserves the full optimization of
check-in [e130319317e76119].
drh [Tue, 19 Feb 2019 17:45:31 +0000 (17:45 +0000)]
Fix a potential memory leak in RBU if the rbu_fossil_delta() SQL function is
misused. Misuse never happens in a working RBU system, so this is not a
particularly important fix.
drh [Tue, 12 Feb 2019 21:04:33 +0000 (21:04 +0000)]
Enhancement the progress callback mechanism so that the progress callback
is always invoked at least once at the end of a prepared statement if the
opcode count has been exceeded. This makes the progress callback more
effective at limiting run times. This check-in also includes and unrelated
performance enhancement to OP_Column.