drh [Thu, 14 Nov 2019 17:46:32 +0000 (17:46 +0000)]
Fix a bug in the hard_heap_limit pragma so that it returns the new value of
the hard_heap_limit, not the soft_heap_limit. Change SQLITE_MAX_MEMORY so
that it works by setting the default hard_heap_limit value.
drh [Thu, 14 Nov 2019 13:24:04 +0000 (13:24 +0000)]
Ensure that the same subquery does not go through the window-function rewrite
more than once, even when that subquery is part of a virtual table constraint
that lacks the omit flag.
drh [Sun, 10 Nov 2019 11:09:06 +0000 (11:09 +0000)]
Proper surrogate pair decoding added to JSON functions. See the mailing list
bug report and [https://bugs.python.org/issue38749]. More test cases
needed here, but it seems to work so far.
drh [Fri, 8 Nov 2019 20:13:44 +0000 (20:13 +0000)]
When a virtual table reports orderByConsumed, that tells us nothing about
whether or not the SQLITE_DISTINCTBY constraint is met.
Fix for ticket [7e59041f9c4e5102].
Test cases in TH3.
drh [Thu, 7 Nov 2019 14:51:24 +0000 (14:51 +0000)]
Fix the xferCompatibleIndex() function so that it recognizes that a PRIMARY KEY
index for a WITHOUT ROWID table is different from a UNIQUE constraint index
on the primary key. Ticket [302027baf1374498]
drh [Thu, 7 Nov 2019 02:32:54 +0000 (02:32 +0000)]
Restore generated column loop detection logic that was incorrectly removed
from the previous check-in [9e07b48934e9a972]. This fixes ticket
[299b50ba812d8e54]
drh [Mon, 4 Nov 2019 02:05:52 +0000 (02:05 +0000)]
Fix a false-postive in the sqlite3ExprImpliesNonNullRow() decision routine,
that resulted in an incorrect LEFT JOIN strength reduction when the
WHERE clause contained a row-value comparison.
Ticket [02aa2bd02f97d0f2]
drh [Sun, 3 Nov 2019 00:07:41 +0000 (00:07 +0000)]
The optimization of check-in [9b2879629c34fc0a] is incorrectly reasoned.
The WHERE clause of the partial index might not be true if the table of
the partial index is the right table of a left join. So disable the
optimization in that case. Ticket [623eff57e76d45f6]
drh [Sat, 2 Nov 2019 13:32:50 +0000 (13:32 +0000)]
In sqlite3GenerateIndexKey(), do not attempt to reuse column values from
the previous index if the current index is a partial index as the partial
index test may have corrupted those values. Ticket [a9efb42811fa41ee]
drh [Fri, 1 Nov 2019 15:19:24 +0000 (15:19 +0000)]
Omit the optimization that reduces the column-count on rowid-table cursors
when the table has generated columns, because we do not know what columns the
generator expressions might try to access.
drh [Fri, 1 Nov 2019 10:49:15 +0000 (10:49 +0000)]
Fix a potential array bounds overflow in the mkkeywordhash.c code generator.
Also add marks to omit keywords specific to generated columns when building
with -DSQLITE_OMIT_GENERATED_COLUMNS.
drh [Wed, 30 Oct 2019 18:50:08 +0000 (18:50 +0000)]
Always disallow the use of non-deterministic functions in CHECK constraints,
even date/time functions that use the 'now' or similar keywords. Provide
improved error messages when this requirement is not met.
Ticket [830277d9db6c3ba1]
drh [Wed, 30 Oct 2019 16:29:02 +0000 (16:29 +0000)]
Simplify the bytecode generation for SQL function calls such that the
OP_Function or OP_PureFunc opcodes are coded directly, rather than using
the intermediate OP_Function0 or OP_PureFunc0 - opcodes that are now removed.
drh [Tue, 29 Oct 2019 16:18:45 +0000 (16:18 +0000)]
Remove the legacy_file_format PRAGMA. In its place, provide the
SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option to sqlite3_db_config().
Fix for ticket [6484e6ce678fffab]
drh [Tue, 29 Oct 2019 03:30:26 +0000 (03:30 +0000)]
Add a missing translation from table column numbers to storage table numbers
while processing constraints on an UPDATE statement.
Ticket [9621dd78a024d07a]
drh [Sat, 26 Oct 2019 23:51:44 +0000 (23:51 +0000)]
Remove code from the constraint checker that generates virtual column values
with the incorrect time. Turns out the the regular code for all other
columns works correctly and so the incorrect special-case code is not
actually needed. Fix for ticket [3ea175512444b0d1].
drh [Sat, 26 Oct 2019 17:08:06 +0000 (17:08 +0000)]
Performance optimization on sqlite3GenerateConstraintChecks() - bypass the
loop that checks each column for NOT NULL constraints if it is known in
advance that the table has no NOT NULL constraints.
drh [Sat, 26 Oct 2019 12:27:55 +0000 (12:27 +0000)]
Overnight, OSSFuzz helpfully pointed out a potential use-after-free bug in
yesterdays changes, involving continued use of a pointer after the memory
pointed to had been realloc()-ed. Thanks Google.
drh [Sat, 26 Oct 2019 00:04:21 +0000 (00:04 +0000)]
If replace triggers are run during uniqueness checking, then rerun all
uniqueness checks a second time using the ABORT algorithm.
Fix for ticket [c1e19e12046d23fe]
drh [Wed, 23 Oct 2019 18:09:39 +0000 (18:09 +0000)]
When a vector comparison appears in the WHERE clause and the constraint side
has a COLLATE clause on the first term of the vector, be sure to honor that
COLLATE clause. Ticket [135c9da7513e5a97].
drh [Tue, 22 Oct 2019 19:51:29 +0000 (19:51 +0000)]
Disqualify row-value comparisons for use by an index if the right-hand side
has an affinity that does not match the index.
Fix for ticket [6ef984af8972c2eb]
drh [Tue, 22 Oct 2019 13:59:23 +0000 (13:59 +0000)]
In UPDATE processing, include generated columns in the set of columns being
updated if and only if their generator expressions reference some other
column that is being updated.
drh [Tue, 22 Oct 2019 01:00:16 +0000 (01:00 +0000)]
Move the sqlite3LocateCollSeq(), sqlite3FindCollSeq(), and
sqlite3GetCollSeq() routines so that they are all beside one another in
the callback.c source file. No logic changes.
drh [Tue, 22 Oct 2019 00:03:41 +0000 (00:03 +0000)]
When flipping ("commuting") a comparison operator, set the new EP_Commuted
bit rather than adding extra EP_Collate bits, to single later processing that
the order of precedence for COLLATE operators is inverted.
Fix for ticket [b47e3627ecaadbde]
drh [Fri, 18 Oct 2019 15:58:50 +0000 (15:58 +0000)]
Enhance the ".imposter" command in the CLI so that the first argument
can be an existing WITHOUT ROWID table instead of an index. The resulting
imposter is the same table, but with columns in storage order and with
all constraints removed.