drh [Wed, 18 Aug 2021 19:22:27 +0000 (19:22 +0000)]
Trying to insert an incorrect datatype into a STRICT table raises an
SQLITE_CONSTRAINT_DATATYPE error. Seems to work, though lots more testing
is needed.
drh [Wed, 18 Aug 2021 13:13:58 +0000 (13:13 +0000)]
What would it be like if you could add the keyword "STRICT" after a CREATE
TABLE statement to cause the table to (1) allow only a few well-defined
datatypes, (2) rigidly enforce those types, (3) require NOT NULL on PK
columns, (4) always enforce foreign key constraint, and so forth? This
branch seeks to explore that question.
drh [Tue, 17 Aug 2021 19:59:09 +0000 (19:59 +0000)]
Fix an off-by-one error in the error-handling logic of the Lemon
parser-generator. This does not affect SQLite.
[forum:/forumpost/cff80737bf|Forum cff80737bf].
dan [Thu, 12 Aug 2021 14:22:30 +0000 (14:22 +0000)]
By default, do not use memory mapping to access the temporary files used for external sorts. The old behaviour (to use memory mapping by default) may be restored by building with SQLITE_ENABLE_SORTER_MMAP defined.
drh [Wed, 11 Aug 2021 18:43:54 +0000 (18:43 +0000)]
During DELETE, if an index entry is missing, do not raise the
SQLITE_CORRUPT_INDEX error (added by [f339f31f9e9a856b]) if in
"PRAGMA writable_schema=ON" mode.
drh [Wed, 11 Aug 2021 13:48:56 +0000 (13:48 +0000)]
Do not apply the push-down optimization to CTE subqueries that will be
reused in other contexts in where the same optimization is unlikely to
be valid. Fix for the bug reported by
[forum:/forumpost/d496c3d29bc93736|forum post d496c3d29bc93736].
drh [Mon, 9 Aug 2021 17:37:58 +0000 (17:37 +0000)]
Undocumented "--threadsafe N" option added to the CLI for testing purposes.
One of SQLITE_CONFIG_SINGLETHREAD, _MULTITHREAD, or _SERIALIZED is called
depending on the value of the N integer.
drh [Thu, 5 Aug 2021 15:27:19 +0000 (15:27 +0000)]
Store the collating sequence name for each column of a table as an
extension to the column name, for an additional savings in the heap space
needed to hold the schema.
drh [Wed, 4 Aug 2021 13:42:12 +0000 (13:42 +0000)]
Always prefer built-in SQL functions over app-defined SQL functions within
sqlite3NestedParse(). Formerly this was the case for a few calls to
sqlite3NestedParse(), but not for all of them.
dan [Wed, 4 Aug 2021 11:29:18 +0000 (11:29 +0000)]
Avoid using LIKE with the target db in RBU. It is possible the user may issue "PRAGMA case_sensitive_like = 1" or override the like() user function, causing RBU to malfunction.
Recognize certain standard datatypes ("INT", "INTEGER", "REAL", "TEXT", and
"BLOB") and if a column has one of those datatypes, store the type part of
the bit-field information in the Column structure to save space.
If a generated column uses the optional keywords GENERATE ALWAYS, try to avoid
putting those keywords in the typename of the column.
[forum:/forumpost/ff3ffe09251c105b|Forum post ff3ffe09251c105b]
Minor tweaks to various TCL build scripts so that they work even for TCL 8.4,
which is obsolete, but is also all that is available for some legacy platforms.
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.