drh [Fri, 11 Jun 2021 12:41:14 +0000 (12:41 +0000)]
Avoid bugs in some implementations of dlopen() by avoiding calls to
dlopen() with a filename argument that exceeds FILENAME_MAX bytes.
[forum:/forumpost/08a0d6d9bf|Forum post 08a0d6d9bf].
drh [Tue, 8 Jun 2021 23:46:59 +0000 (23:46 +0000)]
Remove two assert()s in FTS5 that checks for database corruption right before
actual code does the same check.
dbsqlfuzz 9680db8f5338cb9b6060eb3a02d984555d4472e3.
drh [Tue, 8 Jun 2021 17:56:16 +0000 (17:56 +0000)]
Try to avoid a double-free in the showdb utility program when running
pgidx on a corrupt database.
See [forum:/forumpost/a60ea5a4d4|forum post a60ea5a4d4] for context
drh [Mon, 7 Jun 2021 11:50:23 +0000 (11:50 +0000)]
Fix an assert() in the OP_ParseSchema opcode that might fail on a corrupt
database file when running with PRAGMA writable_schema=ON.
dbsqlfuzz e7d743ca65f2767e415095f0c5a49166a0f55eea.
drh [Mon, 7 Jun 2021 00:41:18 +0000 (00:41 +0000)]
Omit the unnecessary highlighting of the security implications of
SQLTIE_DIRECTONLY in the sqlite3_create_function() documentation.
No changes to code.
drh [Fri, 4 Jun 2021 16:17:38 +0000 (16:17 +0000)]
Add the (missing) dependency of regexp.c to the shell.c rule in the makefiles.
This dependency should have been added by [5d4535bfb603d7c8] but was missed.
drh [Fri, 4 Jun 2021 15:56:43 +0000 (15:56 +0000)]
Fix more cases in the regexp extension where the 0x00 terminator at the end
of the input string is being pattern matched.
[forum/forumpost/9104f0d9e7|Forum post 9104f0d9e7].
drh [Thu, 3 Jun 2021 18:51:51 +0000 (18:51 +0000)]
Fix the truncate optimization so that PRAGMA count_changes and changes()
return correct values even for a WITHOUT ROWID table.
[forum:/forumpost/07dedbf9a1|Forum post 07dedbf9a1].
drh [Thu, 3 Jun 2021 12:31:08 +0000 (12:31 +0000)]
Fix the case-insensitive version of the regexp() function so that it does not
use the prefix optimization incorrectly.
[forum:/forumpost/983b43ef8e|Forum post 983b43ef8e].
dan [Tue, 1 Jun 2021 15:37:14 +0000 (15:37 +0000)]
Fix a problem with running ALTER TABLE against schemas that contain compound SELECT statements with ORDER BY clauses containing one or more references to the second or subsequent component SELECT statements.
drh [Sat, 29 May 2021 23:07:59 +0000 (23:07 +0000)]
Do not confuse the ">" operator with IS NOT NULL when checking to see if
a partial index is usable.
[forum:/forumpost/d813704d7c|Forum post d813704d7c].
drh [Fri, 28 May 2021 12:48:31 +0000 (12:48 +0000)]
Make a deep copy of the result of a subquery in case the subquery is
reused. Fix for the problem reported by
[forum:/forumpost/28216b36ac|forum post 28216b36ac] and introduced by
check-in [f30fb19ff763a7cb]. Further changes to try to optimize the new
OP_Copy opcode back into either OP_SCopy or OP_Move will be attempted
separately. A test case will be in TH3.
drh [Wed, 26 May 2021 23:10:19 +0000 (23:10 +0000)]
Improvements to the constant-propagation optimization in order to better
deal with unusual affinities. See
[forum:/forumpost/6a06202608|forum post 6a06202608] for more detail.
drh [Wed, 26 May 2021 18:46:51 +0000 (18:46 +0000)]
Take care that the code is not generated for the same Select object more
than once, as transformations that apply during the first pass might
cause problems for the second pass.
dbsqlfuzz 836b625cd8a41809ef80fc7ebaa6554357bcb463.
drh [Mon, 24 May 2021 00:17:04 +0000 (00:17 +0000)]
Additional defenses (above and beyond [b986600520696b0c]) to prevent an
invalid subquery from causing problems downstream. If an error is found
while analyzing a subquery expression, change the expression to TK_ERROR
so inhibit further processing on that expression.
dbsqlfuzz cf624b8c0484c66e0f552bf6475e3e3f2c22b24e.
drh [Sat, 22 May 2021 11:23:20 +0000 (11:23 +0000)]
Do not invoke sqlite3ExprAffinity() after a syntax error that might have
left the tree in an inconsistent state. See also [e8a1515b44380cc5] and
[forum:/forumpost/7e484e225c|forum post 7e484e225c].
drh [Sat, 22 May 2021 11:00:03 +0000 (11:00 +0000)]
The fix in the previous check-in was only correct if the OOM occurs on
the initial allocation. This changes should make it correct for a resize
as well.
drh [Fri, 21 May 2021 21:49:07 +0000 (21:49 +0000)]
If there are errors in a nested CTE, be sure to abandon processing. Do not
continue since the parse tree may have been left in a goofy state which could
cause use-after-free and segfaults.
See [forum:/forumpost/aa4a7a3980|forum post aa4a7a3980] for an example.
drh [Thu, 20 May 2021 00:44:04 +0000 (00:44 +0000)]
Replace [0f0959c6f95046e8] with a new and better solution that also fixes the
CTE name resolution problem described in
[forum:/forumpost/8590e3f6dc|forum post 8590e3f6dc].
Test cases for both problems added.
drh [Wed, 19 May 2021 21:55:56 +0000 (21:55 +0000)]
When constructing the synthensized SELECT statement that is used to choose
the rows in an UPDATE FROM, make sure the first table is really the table
being updated, and not some common-table expression that happens to have the
same name. [forum:/forumpost/a274248080|forum post a274248080]. More
changes associated with CTE name resolution are pending.
drh [Tue, 18 May 2021 19:10:10 +0000 (19:10 +0000)]
In the MULTI-INDEX OR query plan, code for sub-expressions can sometimes be
generated twice. But for some subqueries, generating code off of the same
tree twice causes problems. So now MULTI-INDEX OR makes a copy of the
sub-expressions it uses to avoid code-generating them more than once.
dbsqlfuzz 9ebd2140e7206ff724e665f172faea28af801635.
dan [Mon, 17 May 2021 16:20:41 +0000 (16:20 +0000)]
Fix problems with refering to CTEs from within sub-selects in PARTITION BY or ORDER BY clauses of window frame definitions. Also a problem with renaming a column when the schema contains a trigger containing a correlated sub-select within a window frames PARTITION BY or ORDER BY clause.
drh [Mon, 17 May 2021 13:11:24 +0000 (13:11 +0000)]
When deleting an SQL function that does not exist, return without doing
anything at all rather than creating a tombstone function. In this way,
function deletes that happen inside virtual-table destructors that are run
when a database connection is closing do not create new tombstones in the
function table after the function table has already been purged.
[forum:/forumpost/726219164b|forum post 726219164b].
drh [Fri, 14 May 2021 14:26:57 +0000 (14:26 +0000)]
Attempt the [/info/f4229707ac08d66c|constant propagation optimization] on any
WHERE clause that has a top-level AND operator, even if the query is not
a join. This is an attempt to partially address the concern raised in
[forum:/forumpost/830d37b928|forum post 830d37b928].
drh [Thu, 13 May 2021 18:24:22 +0000 (18:24 +0000)]
Modify the sqlite3_stmt_readonly() interface so that it returns false for
CREATE TABLE IF NOT EXISTS statements even if the table already exists and
the statement is really a read-only no-op. Likewise for DROP TABLE,
CREATE INDEX, and DROP INDEX. Update the documentation for
sqlite3_stmt_readonly() to reflect this new behavior.
drh [Thu, 13 May 2021 13:43:40 +0000 (13:43 +0000)]
The content columns of the index-btree that implements a WITHOUT ROWID
table are not ordered and so the query planner should not assume they
are ordered. Fix for the issue identified by
[forum:/forumpost/6c8960f545|forum post 6c8960f545].