drh [Wed, 2 Feb 2022 16:24:01 +0000 (16:24 +0000)]
Relax the restriction that the RHS of the IN operator must be a list in order
for sqlite3_vtab_in() to work. Change an unreachable branch into an assert().
drh [Wed, 2 Feb 2022 14:36:58 +0000 (14:36 +0000)]
Refactor sqlite3_vtab_in() to make use of the existing
sqlite3_value_pointer() mechanism for passing the list of IN operator
RHS values into xFilter, for improved memory safety.
drh [Tue, 1 Feb 2022 12:28:17 +0000 (12:28 +0000)]
CLI: Add the --ww option as an alias for --wordwrap. Improve the wordwrap
algorithm so that it breaks at punctuation if it cannot find space. Always
wordwrap with --ww even if there is a .width setting for the column.
drh [Tue, 1 Feb 2022 00:00:08 +0000 (00:00 +0000)]
CLI: In ".mode column" output, if any row contains a newline or wraps, then
put a single blank line in between each pair of rows to provide additional
visual separately.
drh [Mon, 31 Jan 2022 15:59:43 +0000 (15:59 +0000)]
Do not attempt to limit the number of columns used in a table to a prefix
if the table will be used to construct an automatic index or bloom filter.
dbsqlfuzz 787d9bd73164c6f0c85469e2e48b2aff19af6938.
drh [Mon, 31 Jan 2022 14:14:29 +0000 (14:14 +0000)]
CLI: Enhancements to columnar output modes. (See
[forum/forumpost/5b53cd851f66441f9|forum post 5b53cd851] for discussion.)
New output mode "qbox". New output options "--quote" and "--wrap N".
drh [Sun, 30 Jan 2022 21:09:03 +0000 (21:09 +0000)]
CLI: For columnar modes ("box", "column", "table", "markdown") the ".width"
is now both the minimum and maximum width of the column. Text that spans
multiple lines or that contains tabs is properly formatted. If any part of
the output contains multi-line text, then extra separators are provided between
each row.
drh [Fri, 28 Jan 2022 23:44:27 +0000 (23:44 +0000)]
Add the SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET
constraints to the sqlite3_index_info for the xBestIndex method of virtual
tables.
drh [Fri, 28 Jan 2022 13:18:40 +0000 (13:18 +0000)]
Enable SQLITE_INDEX_CONSTRAINT_LIMIT/OFFSET even if there are vector
comparison operators in the WHERE clause. Also: Do not enable
sqlite3_vtab_rhs_value() for LIMIT/OFFSET if the value is negative, as this
violates an invariant on Expr.u.iValue.
drh [Thu, 27 Jan 2022 13:52:01 +0000 (13:52 +0000)]
Enforce the restriction that 'unixepoch' only works as the first modifier
after the time-value. This has been documented since 2004, but has never
actually been enforced before. Also add new test cases for date/time
functions with evidence marks.
dan [Mon, 24 Jan 2022 11:25:42 +0000 (11:25 +0000)]
Ensure that any error encountered while coding a trigger program is transfered to the main Parse structure before it is used with any other routine that might set the error code.
drh [Sat, 22 Jan 2022 22:28:32 +0000 (22:28 +0000)]
Add support for the sqlite3_vtab_distinct() interface. Virtual table
implementations can use this API to determine more detail about the ordering
requirements needed by the query plan and perhaps reduce the amount of
work required to compute a correct answer. This is an optimization
opportunity for the virtual table implementation. The correct answer should
still be obtained (though perhaps more slowly) even if sqlite3_vtab_distinct()
is ignored.
drh [Fri, 21 Jan 2022 16:41:11 +0000 (16:41 +0000)]
When computing a vector to be used as a key for an index lookup, do not
check for NULL values and abort until after all key values have been
computed, in case one of the later key values involves some initialization
that is needed by a LEFT JOIN. Fix for the problem identified by
[forum:/forumpost/ab95010d410a0a55|Forum post ab95010d410a0a55].
drh [Fri, 21 Jan 2022 01:00:53 +0000 (01:00 +0000)]
Add the sqlite3_vtab_rhs_value() interface, allowing the xBestIndex method
of a virtual table to access known values on the right-hand side of
constraint expressions.
drh [Thu, 20 Jan 2022 02:04:53 +0000 (02:04 +0000)]
Fix the ability to read read-only WAL-mode database when -shm is present,
([00ec95fcd02bb415|check-in 00ec95fcd02bb415]) so that it works
for the case of 64K page size.
drh [Mon, 17 Jan 2022 23:37:25 +0000 (23:37 +0000)]
Allow an "IntReal" value to count as a REAL when checking types for
insertion into a generated column on a STRICT table.
[forum:/forumpost/fa012c77796d9399|Forum post fa012c77796d9399].
drh [Mon, 17 Jan 2022 15:23:57 +0000 (15:23 +0000)]
Fix incorrect testcase() and assert() macros in json.c. They were not causing
problems. The assert() was simply unreachable. The testcase() added an
unreachable condition.
drh [Mon, 17 Jan 2022 14:42:38 +0000 (14:42 +0000)]
Never allow the b-tree layers view of the number of pages in the database
file exceed the actual number of pages in the database file, even when
PRAGMA writeable_schema=ON. This helps with earlier detection of corruption,
and prevents excess memory usage and CPU cycles in some integrity_check ops.
drh [Wed, 12 Jan 2022 20:31:14 +0000 (20:31 +0000)]
When the result of a subquery is to be stored in a register and that
subquery has an ORDER BY clause and an OFFSET, NULL out the destination
register before starting the ORDER BY so that the register will be set
correctly even if the OFFSET is larger than the number of output rows.
Fix for the problem reported in
[forum:/forumpost/0ec80f12d02acb3f|forum post 0ec80f12d02acb3f].
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().