Remove ALWAYS() macros that can be true if the internal test function
implies_nonnull_row() is used in the result set of a query and contains
comparison operator against a computed column.
dbsqlfuzz 4c34db5bff6247f33ee49e341a1f3018e72be0a0.
Enhance the CLI with the ".connection" command that can switch between
up to five different database connections. Used for manual testing of multiple
database connections in the same process.
Set the checkSchema flag if a CREATE TABLE parse fails because the table
already exists, to ensure that the table was not previously deleted by
some other connection.
Fix ALTER TABLE DROP COLUMN so that it generates valid bytecode even when
operating on a corrupt database and using PRAGMA writable_schema=ON.
dbsqlfuzz 5f09e7bcc78b4954d06bf9f2400d7715f48d1fef
One of the optimizations of check-in [de9c86c9e4cdb34f] does not work for
terms originating in the ON/USING clause, as demonstrated by
[forum:/forumpost/6cf3bb457c3f4685|forum post 6cf3bb457c3f4685]. This
check-in disables that optimization for ON/USING terms. Also improve the
TreeView display for the resulting "true"/"false" nodes to show that they
originate from the ON/USING clause. Add a testcase() to the other optimization
to show that it can still be used for ON/USING terms.
Improved robustness of cursor renumbering in the UNION ALL flattener
when operating on vector assignments of an UPDATE FROM.
dbsqlfuzz 417d2b053b9b3c9edaf22dd515564f06999e029c
Run a "PRAGMA quick_check", if necessary, on the modified table after
an ALTER TABLE ADD COLUMN to verify that added NOT NULL or CHECK constraints
are satisfied by existing rows. Abort the ADD COLUMN if not.
[forum:/forumpost/c04814903d6ec4f7|Forum post c04814903d6ec4f7].
dan [Tue, 20 Jul 2021 14:57:49 +0000 (14:57 +0000)]
Avoid a malfunction that could occur if the same correlated column reference appears in both the GROUP BY and the HAVING clause of a sub-select. dbsqlfuzz a779227f721a834df95f4f42d0c31550a1f8b8a2.
More precision in comparing integers and floating point values while
processing the integer primary key for OP_SeekGE and similar.
[forum:/forumpost/2bdb86a068|Forum post 2bdb86a068].
Try to omit the ORDER BY clause in subqueries if doing so does not change
the result in any way. See
[forum:/forumpost/2d76f2bcf65d256a|Forum post 2d76f2bcf65d256a] for
details and history.
Modify the generate_series() table-valued functions so that its first
argument (the START value) is required. Throw an error if that argument
is not supplied. In this was the series.c loadable extension can be used
as a demonstration of how to code an xBestIndex function to require certain
parameters. Compile with -DZERO_ARGUMENT_GENERATE_SERIES to obtain the
legacy behavior.
Attempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BY
clauses do not affect the output. See
[forum:/forumpost/2d76f2bcf65d256a|forum thread 2d76f2bcf65d256a] for
discussion. This can help the query flattener in
some cases, resulting in faster query plans. The current implemention does
not always work.
Enhance the sqlite3_create_function() interfaces to assume a value of
SQLITE_UTF8 is presented with a nonsense value for the preferred encoding.
This is undocumented behavior added for robustness.
dan [Thu, 8 Jul 2021 18:29:25 +0000 (18:29 +0000)]
Preserve and return to the user any error message returned by a failed xConnect() call on an eponymous virtual table that prevents a query from being compiled.
Follow-up to [68db1ff9c44fa9c3]: The number of registers needed by
PRAGMA foreign_key_check was increased too late for an assert() deep
down inside of sqlite3ExprCode(). So move the size increase a little
earlier.
[forum:/forumpost/79c9e4797d|Forum post 79c9e4797d].
dan [Wed, 7 Jul 2021 15:52:44 +0000 (15:52 +0000)]
Fix a recently introduced segfault that might occur if a sub-select were used as a term on the RHS of an IN(...) operator for which the LHS is a row-value.
dan [Wed, 7 Jul 2021 13:53:55 +0000 (13:53 +0000)]
Improve the error message in cases where there is a row-value on the LHS of an IN() operator, the RHS is a list (not a sub-select) and at least one element of the list is not a row-value with the correct number of elements.
dan [Wed, 7 Jul 2021 11:51:03 +0000 (11:51 +0000)]
Instead of disallowing writes to fts5 tables if there are fts5vocab cursors open on them (commit [c49a6ed7]), abort any fts5vocab queries if the on-disk structure of the fts5 table changes.
Add the ATOMIC_INTRINSICS compile-time output output. Move sqlite3Int.h
in front of ctime.c so that default values that are not overridden are
shown in PRAGMA compile-time option output.
dan [Mon, 5 Jul 2021 17:15:38 +0000 (17:15 +0000)]
Revert [5204c2c4a7b73a64], restoring the old pre-processor logic for determining the availability of the __atomic_store_n()/__atomic_load_n() primitives.
dan [Mon, 5 Jul 2021 11:27:13 +0000 (11:27 +0000)]
Allow sub-queries in the FROM clause of an UPDATE...FROM statement to access the object being updated without using an alias, as is required in the parent query.
Improved rebustness in sqlite3ExprListDup() when it contains a vector assignment
from an UPDATE where the initial term is omitted. This can happen during a
UNION ALL query flattening while processing a virtual table update in which
the first term of the vector is repeated.
[forum:/forumpost/16ca0e9f32|Forum post 16ca0e9f32].
Ensure that TK_SELECT_COLUMN Expr nodes always have their iTable field set to
to the number of columns in the vector. This is not strictly necessary. It
just simplifies the state description and make the code easier to reason about.
In the PRAGMA foreign_key_check, ensure that sufficient registers are
allocated for the virtual machine, even if one or more foreign keys reuses
the same column multiple times and has more columns than the table it is part
of. [forum:/forumpost/a6b0c05277|Forum post a6b0c05277].
Fix a harmless assertion fault discovered by
[https://oss-fuzz.com/testcase-detail/5517690440646656|OSSFuzz]. The
assertion fault is harmless because the assert() checks a condition that
that is harmless if false and the assert() is disabled in production
builds.
Import the updated nmakehlp.c file used by the TCL Extension Architecture (TEA)
builds in the amalgamation tarballs.
[forum:/forumpost/5a5001f20a|Forum post 5a5001f20a].
drh [Wed, 30 Jun 2021 11:53:21 +0000 (11:53 +0000)]
Do not enforce the SQLITE_LIMIT_FUNCTION_ARG limit for internally generated
SQL. This prevents problems with statements like ALTER TABLE if the
function argument limit is set too low.
[forum:/forumpost/17735aa21f3ddab2|Forum post 17735aa21f3ddab2].
drh [Fri, 25 Jun 2021 14:48:24 +0000 (14:48 +0000)]
The OP_ReopenIdx opcode should clear the cursor if the cursor is being
reused. This prevents leaving the cursor in an initialized state which
could cause problems for a subsequent OP_SeekScan opcode.
Fix for ticket [6dcbfd11cf666e21] and the OP_SeekScan optimization
of check-in [4a43430fd23f8835].
drh [Fri, 25 Jun 2021 11:14:10 +0000 (11:14 +0000)]
Fix a bug in the ".fullschema" dot-command of the CLI brought to light by
check-in [a2ddb89b206c1387] - raising an error on at attempt to access the
rowid of a subquery or view.
drh [Thu, 24 Jun 2021 18:23:54 +0000 (18:23 +0000)]
Allow the SQLITE_OPEN_EXCLUSIVE flag in sqlite3_open(). Return the
SQLITE_CANTOPEN_EXISTS extended code to indicate that the open failed because
the database already exists.
drh [Tue, 22 Jun 2021 23:24:58 +0000 (23:24 +0000)]
When an index is used by all branches of the WHERE_MULTI_OR optimization and
becomes a covering index, make sure the index has been created prior to
NULLing it in the OP_NullRow opcode of a LEFT JOIN. See
[forum:/forumpost/0575376e07|forum post 0575376e07]. The covering-index for
WHERE_MULTI_OR optimization was added by [62678be3df35cdcb]. Test cases are
in the orindex01.test module of TH3.
dan [Tue, 22 Jun 2021 18:06:23 +0000 (18:06 +0000)]
Fix a problem causing sqlite3_changes() to return an incorrect value following a "DELETE FROM tbl" command on an intkey table (because internal b+tree cells were being included in the count).
drh [Sat, 19 Jun 2021 18:32:20 +0000 (18:32 +0000)]
Split the sqlite3BtreeMovetoUnpacked() routine into two separate routines
sqlite3BtreeTableMoveto() and sqlite3BtreeIndexMoveto(), since we usually
know the type of btree in advance. This results in less branching and
better performance.