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.
drh [Tue, 15 Jun 2021 15:36:05 +0000 (15:36 +0000)]
Update the "nmakehlp.c" utility program sources associated with the TCL
Extension Architecture, obtained from
[https://core.tcl-lang.org/sampleextension/file]. Perhaps this new
version will sit better with salmonx's static analyzer
[forum:/forumpost/7f0beca9797ee23a|(ref1)],
[forum:/forumpost/7d5c8b19231ad57f|(ref2)].
drh [Tue, 15 Jun 2021 15:15:40 +0000 (15:15 +0000)]
Add NULL checks on all sqlite3_vfs_find(0) calls. This is not strictly
necessary. There are no vulnerabilities here. However, adding these
checks avoids unnecessary static analyzer complaints.
[forum:/forumpost/ce1193be15|Forum post ce1193be15].
drh [Mon, 14 Jun 2021 14:00:09 +0000 (14:00 +0000)]
An index on the expression "likely(X)" should store the true value of X,
even if X is a real number with no fractional part. The optimization of
storing some REAL indexed values as INT (see [10d851353c2abead]) should
be omitted for index columns that are expressions.
[forum:/forumpost/3b940c437a|Forum post 3b940c437a].
drh [Sat, 12 Jun 2021 18:12:59 +0000 (18:12 +0000)]
The sqlite3WithPush() routine might destroy its second argument if there was
a prior OOM. Do not use the second argument of sqlite3WithPush() if this
happens.
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.