]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
2 years agoMerge version 3.39.4 changes into the reuse-schema-3.39 branch. reuse-schema-3.39
drh [Fri, 30 Sep 2022 12:27:46 +0000 (12:27 +0000)] 
Merge version 3.39.4 changes into the reuse-schema-3.39 branch.

FossilOrigin-Name: 8102592836dcf6f08749a516e126f3990a20f40866ed4a6e85d134ab49907ece

2 years agoVersion 3.39.4 version-3.39.4
drh [Thu, 29 Sep 2022 15:55:41 +0000 (15:55 +0000)] 
Version 3.39.4

FossilOrigin-Name: a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309

2 years agoFix misuse of the sqlite3_set_auxdata() interface in the ICU extension.
drh [Wed, 28 Sep 2022 19:19:11 +0000 (19:19 +0000)] 
Fix misuse of the sqlite3_set_auxdata() interface in the ICU extension.

FossilOrigin-Name: 6607dd010359d0f2e07e49ce69d4bfd1e57c3505df5d667cf7735facf34112d7

2 years agoRemove a NEVER macro in defragmentPage() that dbsqlfuzz discovered can be
drh [Wed, 28 Sep 2022 13:38:49 +0000 (13:38 +0000)] 
Remove a NEVER macro in defragmentPage() that dbsqlfuzz discovered can be
true.  crash-32d9312f145cdce41613573f6431d9a3e439e3d7

FossilOrigin-Name: a4342fc020a41bc5eed2d8f02ec4a759a78c5b0cbc1ae5e8dc167dcc69aa698d

2 years agoEnhance defensive mode so that it disallows CREATE TRIGGER statements if
drh [Tue, 27 Sep 2022 02:04:52 +0000 (02:04 +0000)] 
Enhance defensive mode so that it disallows CREATE TRIGGER statements if
the statements within the trigger attempt to write on a shadow table.  Also
make the legacy FTS3 code more robust against integer overflow during
memory allocation.

FossilOrigin-Name: c41f25e6f3591e575452c4c68f8072a0163cc00d80af31f90d407c7deca79622

2 years agoEnhance the b-tree page sorting code to ensure that sqlite3PagerRekey() never
dan [Sat, 10 Sep 2022 13:50:33 +0000 (13:50 +0000)] 
Enhance the b-tree page sorting code to ensure that sqlite3PagerRekey() never
overloads a page number and uses only the PENDING_BYTE page for temporary
storage.

FossilOrigin-Name: aa6a5b729782dee75f14ae4e780302c4446074c20d1eb300346fbe874eb64706

2 years agoEnhance an assert() to impose for tighter constraints on the operation of pcache.
drh [Wed, 7 Sep 2022 20:14:38 +0000 (20:14 +0000)] 
Enhance an assert() to impose for tighter constraints on the operation of pcache.

FossilOrigin-Name: 461511cc99e5b1f936d0acbfcfe117c4ceb721a28eed50bb6db7a2244aedb599

2 years agoFix the windows build so that it works with -DSQLITE_OMIT_AUTOINIT.
drh [Wed, 7 Sep 2022 19:58:48 +0000 (19:58 +0000)] 
Fix the windows build so that it works with -DSQLITE_OMIT_AUTOINIT.

FossilOrigin-Name: 1662eb07d8fa01457b3e3f37894234aae27c25a67059da968ab8cb599d3bd8f6

2 years agoEnsure that the Rekey() operation does not overwrite an existing page number.
drh [Wed, 7 Sep 2022 19:50:06 +0000 (19:50 +0000)] 
Ensure that the Rekey() operation does not overwrite an existing page number.

FossilOrigin-Name: cd1e40064ccd9fe2189feb4fd3b77be265990baba8be3d53256b85716650f5bc

2 years agoIncrease the version number to 3.39.4
drh [Wed, 7 Sep 2022 19:35:23 +0000 (19:35 +0000)] 
Increase the version number to 3.39.4

FossilOrigin-Name: e98bed127db003c4ea34d8ca331b29a0256d9073c27a3e914f02030c1b0af77c

2 years agoMerge patches for version 3.39.3 into the reuse-schema-3.39 branch.
drh [Mon, 5 Sep 2022 13:36:32 +0000 (13:36 +0000)] 
Merge patches for version 3.39.3 into the reuse-schema-3.39 branch.

FossilOrigin-Name: efd54164b02f35b5d39ab4d18e349c18f3ec8afb728da39d20373e26742da177

2 years agoVersion 3.39.3 version-3.39.3
drh [Mon, 5 Sep 2022 11:02:23 +0000 (11:02 +0000)] 
Version 3.39.3

FossilOrigin-Name: 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0602f1e826e8

2 years agoEnsure the Pager.journalOff variable is zeroed if an error occurs while writing the...
dan [Fri, 2 Sep 2022 21:21:58 +0000 (21:21 +0000)] 
Ensure the Pager.journalOff variable is zeroed if an error occurs while writing the initial header to the journal file.

FossilOrigin-Name: fe547035ce9204a8e573540115fa8514fbf875e3cae493d88ff3eceb61a67384

2 years agoRemove a NEVER() that is sometimes true.
drh [Fri, 2 Sep 2022 19:18:49 +0000 (19:18 +0000)] 
Remove a NEVER() that is sometimes true.

FossilOrigin-Name: 85a8a117402737352d0c36e9f24a9bdb3842b34f1c520db2d37a2fc91b026486

2 years agoFix an assert() associated with the dbsqlfuzz error at [8372468bb5d8922c].
drh [Fri, 2 Sep 2022 17:26:22 +0000 (17:26 +0000)] 
Fix an assert() associated with the dbsqlfuzz error at [8372468bb5d8922c].

FossilOrigin-Name: f448480e1b93d94ee852b252df6e2fd8649a08f78ab294b07f77307ac0821beb

2 years agoWhen an OOM occurs and sets the Parse.nErr value, also set the Parse.nErr
drh [Fri, 2 Sep 2022 16:45:21 +0000 (16:45 +0000)] 
When an OOM occurs and sets the Parse.nErr value, also set the Parse.nErr
value for all outer Parse objects.
dbsqlfuzz d33f60aaa67733aa700cd69dacf8e0e23a327a29

FossilOrigin-Name: 073621afa2fd833a3ee976d7508a11eca67520e1bc6d5351654fa220c9397976

2 years agoMutex protect access to the sqlite3_test_directory and sqlite3_data_directory
drh [Fri, 2 Sep 2022 12:12:46 +0000 (12:12 +0000)] 
Mutex protect access to the sqlite3_test_directory and sqlite3_data_directory
global variables.  See
[forum:/forumpost/719a11e1314d1c70|forum thread 719a11e1314d1c70].

FossilOrigin-Name: 34c6ec3989fd605f020efa077a0ffacf426456bab1b0290aaa517ccf04fe7de5

2 years agoDefer deleting a transient SELECT statement associated with a flattening
drh [Thu, 1 Sep 2022 14:33:28 +0000 (14:33 +0000)] 
Defer deleting a transient SELECT statement associated with a flattening
of one arm of a compound SELECT until after the parse has completed.

FossilOrigin-Name: 8403c0d5d626eaf6c4830e6d706af3ea2d84a9a12b8eecc6f549fa2ca24352b7

2 years agoDo not attempt the OP_Count optimization on queries with HAVING clauses.
drh [Wed, 31 Aug 2022 14:40:46 +0000 (14:40 +0000)] 
Do not attempt the OP_Count optimization on queries with HAVING clauses.
This fixes a problem exposed by [2cf373b10c9bc4cb].

FossilOrigin-Name: 5f93239a8c0fc724837b208fb3d48fd709c5b60c15e90dbb82fd046c0b735b04

2 years agoAny function call can abort. Take this into account when deciding if a DML
drh [Tue, 30 Aug 2022 14:13:15 +0000 (14:13 +0000)] 
Any function call can abort.  Take this into account when deciding if a DML
statement needs a statement journal.  See
[forum:/forumpost/9b9e4716c0d7bbd1|forum thread 9b9e4716c0d7bbd1] for more
information.

FossilOrigin-Name: 5bf4c5fd0a6ac02392249d3a2057a6fca5b3fcf7c8ad376bbd009d11a9ecd765

2 years agoAvoid having fts3 read uninitialized values when processing deferred tokens.
drh [Fri, 5 Aug 2022 19:37:05 +0000 (19:37 +0000)] 
Avoid having fts3 read uninitialized values when processing deferred tokens.

FossilOrigin-Name: 8e2bfe58030cab8230001c73b60c3ecd421dde5c473b39429ddad610e1d2b1be

2 years agoFix a problem with the query optimizer for LIMIT/OFFSET queries when
drh [Thu, 4 Aug 2022 17:17:41 +0000 (17:17 +0000)] 
Fix a problem with the query optimizer for LIMIT/OFFSET queries when
underlying query is a UNION ALL and both arms of the UNION ALL are
subqueries with an ORDER BY clause.  This bug was reported at
[forum:/forumpost/6b5e9188f0657616|forum post 6b5e9188f0657616].  The
problem was introduced in 2015 (SQLite version 3.9.0) by check-in
[4b631364354068af].  See also ticket [b65cb2c8d91f6685].

FossilOrigin-Name: 5e1db87cfa262deb85447c1e0bc0412bcebec2ee5503b01f309c61c548a7f32c

2 years agoImprovement on the previous check-in.
drh [Wed, 3 Aug 2022 17:27:52 +0000 (17:27 +0000)] 
Improvement on the previous check-in.

FossilOrigin-Name: 0d0c31117a530356495fa24e020bb9536a1c4b68c35a1e96cbd70ea5a7cc4e75

2 years agoFor an IN operator used with a RIGHT JOIN, use the number of terms in the
drh [Wed, 3 Aug 2022 16:04:12 +0000 (16:04 +0000)] 
For an IN operator used with a RIGHT JOIN, use the number of terms in the
vector, not the number of equality terms, to size the column map.
dbsqlfuzz 14cfdad6ca45e607163f54049ddf5065183dc657.

FossilOrigin-Name: 003e4eee6b53a4dee3b8593dc052661d56bd426c8fc184b8a6b5e760a7f9e003

2 years agoBump the version number up to 3.39.3.
drh [Mon, 1 Aug 2022 13:17:41 +0000 (13:17 +0000)] 
Bump the version number up to 3.39.3.

FossilOrigin-Name: d0f7f22a8f4e74d344d9ac7b5bd5a3905179ab1954c8351b0aac912c410a6767

2 years agoIn the xUpdate method of the GeoPoly virtual table, make sure that the
drh [Mon, 1 Aug 2022 13:15:29 +0000 (13:15 +0000)] 
In the xUpdate method of the GeoPoly virtual table, make sure that the
number of updated columns does not exceed the underlying implementation, even
if the virtual table object records an excess number of column in the nAux
field due to table constraints in the table definition.
Fix for the problem reported by
[forum:/forumpost/a096ab7d96bb057a|forum post a096ab7d96bb057a].

FossilOrigin-Name: a8ae721617e75742966cbc77bf56a264e36b7278cb718eb155d72b579c95d5cd

2 years agoMerge the fixes from branch-3.39 into the reuse-schema branch.
drh [Thu, 21 Jul 2022 16:07:24 +0000 (16:07 +0000)] 
Merge the fixes from branch-3.39 into the reuse-schema branch.

FossilOrigin-Name: 578538baf2923f1a2a078d173dfdfb830acf5ce8640de901e9d560c6f4df8a55

2 years agoVersion 3.39.2 version-3.39.2
drh [Thu, 21 Jul 2022 15:24:47 +0000 (15:24 +0000)] 
Version 3.39.2

FossilOrigin-Name: 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603

2 years agoIn the query planner, restore the former aggressiveness in reordering of
drh [Thu, 21 Jul 2022 12:26:01 +0000 (12:26 +0000)] 
In the query planner, restore the former aggressiveness in reordering of
FROM clause terms that existed prior to version 3.39.0 for queries that
contain no RIGHT or FULL JOINs.

FossilOrigin-Name: 9141e873c575b049ce7aeaf313d05966f1966087caf33a6c80d2416a28571a21

2 years agoSimplify the logic that converts the "1" expression in "ORDER BY 1" into a
drh [Wed, 20 Jul 2022 17:01:18 +0000 (17:01 +0000)] 
Simplify the logic that converts the "1" expression in "ORDER BY 1" into a
copy of the expression that defines the first output column.

FossilOrigin-Name: 449935914c3f64e37bbfb9842e868927222fa3d5315c123a32818e67fcfbbf60

2 years agoIncrease the size of loop variables in the printf() implementation to avoid
drh [Mon, 18 Jul 2022 15:27:29 +0000 (15:27 +0000)] 
Increase the size of loop variables in the printf() implementation to avoid
harmless compiler warnings.

FossilOrigin-Name: 26db4fc22fe6665809d321b8a88b60efbbfecd5723ff3e370b857661b981c32c

2 years agoFix harmless compiler warnings seen with MSVC.
mistachkin [Fri, 15 Jul 2022 15:24:10 +0000 (15:24 +0000)] 
Fix harmless compiler warnings seen with MSVC.

FossilOrigin-Name: 2be8fa158e035faf0ec46830a9ec270fb292cd79a882a8fe8dadd19d6ee057a0

2 years agoFix a memory leak in fts3 that could occur when processing a corrupt database.
dan [Fri, 15 Jul 2022 15:11:41 +0000 (15:11 +0000)] 
Fix a memory leak in fts3 that could occur when processing a corrupt database.

FossilOrigin-Name: 48f323b9561969bc7d7157ee361c18b047a876be5907c34d2a73254256934098

2 years agoFix the whereKeyStats() routine (part of STAT4 processing only) so that it
drh [Fri, 15 Jul 2022 12:34:31 +0000 (12:34 +0000)] 
Fix the whereKeyStats() routine (part of STAT4 processing only) so that it
is able to cope with row-value comparisons against the primary key index
of a WITHOUT ROWID table.
[forum:/forumpost/3607259d3c|Forum post 3607259d3c].

FossilOrigin-Name: 2a6f761864a462de5c2d5bc666b82fb0b7e124a03443cd1482620dde344b34bb

2 years agoUpdate some faulty assert() statements in fts3.
dan [Fri, 15 Jul 2022 12:07:25 +0000 (12:07 +0000)] 
Update some faulty assert() statements in fts3.

FossilOrigin-Name: 958d104bcfb63b53b1f7ed745fafed8f392b71ed8b694675502473da735fc6a0

2 years agoBump the version number up to 3.39.2.
drh [Thu, 14 Jul 2022 01:54:17 +0000 (01:54 +0000)] 
Bump the version number up to 3.39.2.

FossilOrigin-Name: c4dbcb282d28bcc9b8001f387d0fc605be928453b3f61d2f5150f529647027b2

2 years agoWhen applying the omit-ORDER-BY optimization, defer deleting the AST of
drh [Thu, 14 Jul 2022 01:49:17 +0000 (01:49 +0000)] 
When applying the omit-ORDER-BY optimization, defer deleting the AST of
the deleted ORDER BY clause until after code generation ends.

FossilOrigin-Name: b88d6c4b814ec4166ec50f32a2f10d7857df05414c0048c1234ab290a273e50c

2 years agoVersion 3.39.1 version-3.39.1
drh [Wed, 13 Jul 2022 19:41:41 +0000 (19:41 +0000)] 
Version 3.39.1

FossilOrigin-Name: 7c16541a0efb3985578181171c9f2bb3fdc4bad6a2ec85c6e31ab96f3eff201f

2 years agoThe query flattener should not run if the subquery is a compound that contains
drh [Wed, 13 Jul 2022 16:06:35 +0000 (16:06 +0000)] 
The query flattener should not run if the subquery is a compound that contains
a RIGHT JOIN in any arm and the subquery is not the first element of the
outer query.  Otherwise, prior elements of the outer query will not have
the JT_LTORJ flag set.  Fix for the problem reported in
[forum:/forumpost/174afeae5734d42d|forum post 174afeae5734d42d].

FossilOrigin-Name: cf9ed7f2e1a7be230a8ff689a759289a6bf59c1c84169f2ed510f74c02e0c2e0

2 years agoFix test case error messages so that they work with after the removal of
drh [Wed, 13 Jul 2022 11:27:20 +0000 (11:27 +0000)] 
Fix test case error messages so that they work with after the removal of
the unnecessary zErrMsg clearing from [44d77a7f807f5dc3].

FossilOrigin-Name: 7b167b87d63f6a7399886c84a40bf53b504aa9f6bd18dd06aad2a02aa0a88b2f

2 years agoUpdate makefiles to fix building the non-amalgamation testfixture with SQLITE_DEBUG.
dan [Tue, 12 Jul 2022 15:12:19 +0000 (15:12 +0000)] 
Update makefiles to fix building the non-amalgamation testfixture with SQLITE_DEBUG.

FossilOrigin-Name: 1ca705641708cc39d984c8f688df1418f9abd7cc39ac8cb6f0cd689f0bc2b568

2 years agoUse 64-bit memory allocation APIs in the sqlite_stmt virtual table, to avoid
drh [Mon, 11 Jul 2022 19:48:48 +0000 (19:48 +0000)] 
Use 64-bit memory allocation APIs in the sqlite_stmt virtual table, to avoid
harmless compiler warnings.

FossilOrigin-Name: 4c40b38cbe04ddd8c1ef442bf14e1625f5494d64c78ae830b9e01fe4c7243394

2 years agoFix harmless compiler warnings.
drh [Mon, 11 Jul 2022 19:29:48 +0000 (19:29 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: 9931bb202e2a4e0a980ebc6164e8f1da6c724e07242f448058e1c4cc3694b2b3

2 years agoIncrease the version number to 3.39.1.
drh [Mon, 11 Jul 2022 14:44:28 +0000 (14:44 +0000)] 
Increase the version number to 3.39.1.

FossilOrigin-Name: 88b1b0327f6d2843a4c84b4f5249162cf81a86bfd43f9412ebe6142d7c2df2fb

2 years agoEnsure that the Parse.nErr flag is set following an SQLITE_TOOBIG error on
drh [Mon, 11 Jul 2022 14:43:33 +0000 (14:43 +0000)] 
Ensure that the Parse.nErr flag is set following an SQLITE_TOOBIG error on
a nested parse.  Fix for the problem identified by
[forum/forumpost/d5a82ba9eedee30c | forum post d5a82ba9eedee30c].
Also, remove unnecessary clearing of the Parse.zErrMsg field
following a nested parse.

FossilOrigin-Name: eaef7b71900ef7701c11f07ec8b0ca3fec7e055ce8fd9c769f36669b482de134

2 years agoFix a problem in fts3 to do with deferred tokens and OR expressions.
drh [Mon, 11 Jul 2022 14:39:55 +0000 (14:39 +0000)] 
Fix a problem in fts3 to do with deferred tokens and OR expressions.

FossilOrigin-Name: bbe999e345d43b2f90493d11b95bb5da39d356bfddfc79234cfa70ac1eb273e8

3 years agoFix for builds with both SQLITE_DEBUG and SQLITE_OMIT_WINDOWFUNC defined.
dan [Tue, 5 Jul 2022 19:56:10 +0000 (19:56 +0000)] 
Fix for builds with both SQLITE_DEBUG and SQLITE_OMIT_WINDOWFUNC defined.

FossilOrigin-Name: dfe46de2d4149fea5031c670f2bcec20851b0941ed9b7adf6cb31a01040362c5

3 years agoFix the initial-prefix optimization for the REGEXP extension such that it
drh [Sun, 3 Jul 2022 14:32:18 +0000 (14:32 +0000)] 
Fix the initial-prefix optimization for the REGEXP extension such that it
works even if the prefix contains characters that require a 3-byte UTF8
encoding.  This should fix the problem reported by
[forum:/forumpost/96692f8ba5|forum post 96692f8ba5].

FossilOrigin-Name: 7a32ccccef7712a40aba86c2204457f6772403befabe0aab19407399df46f096

3 years agoFix documentation and test-script typos and a dependency problem on a Makefile. Fix...
drh [Thu, 30 Jun 2022 14:19:38 +0000 (14:19 +0000)] 
Fix documentation and test-script typos and a dependency problem on a Makefile. Fix the sqlite_stmt extension virtual table so that it shows the state of all
prepared statements for a single instant in time.

FossilOrigin-Name: 0a9e08be6d06e571ef9dc688317271de8054179a0458e196d3bc2dc6262efecc

3 years agoMerge version 3.39.0 into the reuse-schema branch.
drh [Sat, 25 Jun 2022 17:20:36 +0000 (17:20 +0000)] 
Merge version 3.39.0 into the reuse-schema branch.

FossilOrigin-Name: bee9903df5c89823e4e285fa1a56f20c8b0408d55bd74dbf71ea61e993da6dc9

3 years agoVersion 3.39.0 version-3.39.0
drh [Sat, 25 Jun 2022 14:57:57 +0000 (14:57 +0000)] 
Version 3.39.0

FossilOrigin-Name: 14e166f40dbfa6e055543f8301525f2ca2e96a02a57269818b9e69e162e98918

3 years agoChange a harmless assert() into a testcase(). The actually test case code
drh [Sat, 25 Jun 2022 02:39:29 +0000 (02:39 +0000)] 
Change a harmless assert() into a testcase().  The actually test case code
is in TH3.  Fix for the problem described at
[forum:/info/ed29e196d5c4f3d5|forum post ed29e196d5c4f3d5].

FossilOrigin-Name: cd6254fcd32798f7be4e6d827597ddaa2e46ac6e2f0149cd3a3be0416fa18835

3 years agoMerge the 3.39.0 release candidate 1 changes into the reuse-schema branch.
drh [Fri, 24 Jun 2022 16:15:20 +0000 (16:15 +0000)] 
Merge the 3.39.0 release candidate 1 changes into the reuse-schema branch.

FossilOrigin-Name: 506a3e6f242f42d3106f80ad4385a5ef458461fbd056258e65c82dd4e0a80e8c

3 years agoFix a harmless UBSAN warning associated with PRAGMA schema_version
drh [Fri, 24 Jun 2022 12:56:48 +0000 (12:56 +0000)] 
Fix a harmless UBSAN warning associated with PRAGMA schema_version
found by OSSFuzz.

FossilOrigin-Name: e93fd170ce4ae91d572c46d03f68f55d00091d0188030517455017d90d212587

3 years agoIn sqlite3WhereBegin, do not proceed with coding the loop if an error is detected...
dan [Fri, 24 Jun 2022 11:05:36 +0000 (11:05 +0000)] 
In sqlite3WhereBegin, do not proceed with coding the loop if an error is detected as part of WHERE expression analysis.

FossilOrigin-Name: db5266dec601a9513bc8dd09a9f8bb4aef55b780d22610946099e8edd4836587

3 years agoA minor fix to test/fuzzinvariants.c so that it works even with column names
drh [Fri, 24 Jun 2022 11:02:42 +0000 (11:02 +0000)] 
A minor fix to test/fuzzinvariants.c so that it works even with column names
that originally contain a ':' and that are disambiguated.

FossilOrigin-Name: 8d9b1fff9d87522c4464aaf3ff0a7b93db244c59b4010562e35a8f161da4859b

3 years agoMinor correction to a comment. No code changes.
drh [Thu, 23 Jun 2022 12:36:56 +0000 (12:36 +0000)] 
Minor correction to a comment.  No code changes.

FossilOrigin-Name: 5fa00959ebc3a46fe400564d5a30e8c44857cd4f0473fb25e84154019eff3f39

3 years agoEnhance the TCL scrip that generates sqlite3-all.c so that it outputs all
drh [Wed, 22 Jun 2022 18:51:47 +0000 (18:51 +0000)] 
Enhance the TCL scrip that generates sqlite3-all.c so that it outputs all
text in its original order.

FossilOrigin-Name: 83ff1a28e3e7a99fa90d5079897d76529c4256eed859bf7cb98b860fbedfdc5b

3 years agoFix requirements marks that changed due to typo fixes in the documentation.
drh [Wed, 22 Jun 2022 18:33:21 +0000 (18:33 +0000)] 
Fix requirements marks that changed due to typo fixes in the documentation.

FossilOrigin-Name: 5247df05991df979024df5a30bb3473401add92d4c12b01c040a16dda6da39f5

3 years agoMore comment fixes. No changes to code.
drh [Wed, 22 Jun 2022 15:55:28 +0000 (15:55 +0000)] 
More comment fixes.  No changes to code.

FossilOrigin-Name: 5c9133ef431a031249760267ca851239d0857ffba633cac27d3865cf179c3274

3 years agoAllow more line with on the debugging output for SrcItem elements in the
drh [Wed, 22 Jun 2022 14:43:52 +0000 (14:43 +0000)] 
Allow more line with on the debugging output for SrcItem elements in the
parse tree.  This affects debugging builds only and is a no-op for production
builds.

FossilOrigin-Name: edbe24e7fc81ab6c26ab05f2231cb46d157d71a677ce8a2983e0c6e48122a2bd

3 years agoAdditional enhancements to comments. No changes to code.
drh [Wed, 22 Jun 2022 14:25:12 +0000 (14:25 +0000)] 
Additional enhancements to comments.  No changes to code.

FossilOrigin-Name: d9a320448f5693d906adf437800675cd4773701db065f3ed238b933fb80f6681

3 years agoGive dbtotxt an option to prepend .open --hexdb
larrybr [Wed, 22 Jun 2022 14:00:24 +0000 (14:00 +0000)] 
Give dbtotxt an option to prepend .open --hexdb

FossilOrigin-Name: afeee6125d141ae281658a5f7b73e9b77bc252fa387678b2b5837488180bf108

3 years agoFix a typo in a comment. No changes to code.
drh [Wed, 22 Jun 2022 12:54:25 +0000 (12:54 +0000)] 
Fix a typo in a comment.  No changes to code.

FossilOrigin-Name: ef9de201b33678a80bb27c5be8f9dc973c8a4f14af9bfdd3ace36887c8a591ea

3 years agoDisable the short-cut query planner if the NOT INDEXED modifier is used.
drh [Tue, 21 Jun 2022 18:38:18 +0000 (18:38 +0000)] 
Disable the short-cut query planner if the NOT INDEXED modifier is used.
[forum:/forumpost/454d706296|Forum post 454d706296].

FossilOrigin-Name: bd87d107fe474ceeac8bacb01c80bc479edbc2ae4e30697bf54ab91a5a8d2a98

3 years agoAllow a HAVING clause on any aggregate query, even if there is no GROUP BY
drh [Tue, 21 Jun 2022 13:41:24 +0000 (13:41 +0000)] 
Allow a HAVING clause on any aggregate query, even if there is no GROUP BY
clause.  This brings SQLite into closer agreement with PostgreSQL and fixes
the concern raised by
[forum:/forumpost/1a7fea4651|forum post 1a7fea4651].

FossilOrigin-Name: 9322a7c21f1c22ba00e9b889223e89bc1591db6e561ce05091e905e98c1bf2b3

3 years agoAdd an ALWAYS() macro to an always-true branch.
drh [Mon, 20 Jun 2022 19:12:57 +0000 (19:12 +0000)] 
Add an ALWAYS() macro to an always-true branch.

FossilOrigin-Name: 364645d8fe22491cd566e868027e739464205e892753356016b1988ead207af4

3 years agoDo not allow FROM-clause terms on the left side of a RIGHT or FULL JOIN to
drh [Mon, 20 Jun 2022 18:26:14 +0000 (18:26 +0000)] 
Do not allow FROM-clause terms on the left side of a RIGHT or FULL JOIN to
be reordered. [forum:/forumpost/6650cd40b5634f35|forum post 6650cd40b5634f35].
This is probably more strict that necessary to get correct behavior,
but for the first release that supports RIGHT/FULL JOIN it is perhaps better
to be correct than fast.  A less strict constraint might be to prohibit
FROM-clause terms that originate on the left side of a RIGHT JOIN from
crossing from the right side to the left side of a LEFT JOIN.  Revisit this
later.

FossilOrigin-Name: 238453ffab0ba1bdddb529be35da82d5e8fb312a9574003a5441f455e601a909

3 years agoDo not allow an ON clause to references tables to its right if there is a
drh [Mon, 20 Jun 2022 17:04:44 +0000 (17:04 +0000)] 
Do not allow an ON clause to references tables to its right if there is a
RIGHT or LEFT join anywhere in the query.  Other RDBMSes prohibit this always,
but SQLite must allow ON clauses to reference tables to their right for legacy
compatibility, unless there is a RIGHT or LEFT join someplace in the query,
in which case there is no legacy to support.

FossilOrigin-Name: e615dbe02ca949252d1526ed5c48f8ce08159773ea2008ce666484379d0d9854

3 years agoThe fix at [cab9b4cccd13bf0a] was incomplete, as demonstrated by
drh [Mon, 20 Jun 2022 12:42:28 +0000 (12:42 +0000)] 
The fix at [cab9b4cccd13bf0a] was incomplete, as demonstrated by
[forum:/forumpost/57bdf2217d|forum post 57bdf2217d].  This check-in
should complete the fix.

FossilOrigin-Name: fb0a23b6789da8e934562ce9ebd9d58ea13a10fd10dee5cbfc7ac8f394e1aeec

3 years agoFollow-up to check-in [0057bbb508e7662b] - ensure that the database page
drh [Sun, 19 Jun 2022 16:55:07 +0000 (16:55 +0000)] 
Follow-up to check-in [0057bbb508e7662b] - ensure that the database page
has been initialized prior to continuing with the optimization.  If the page
is not initialized, that indicates that the database is corrupt.
dbsqlfuzz 09ee46becd5e6d1b2a55c9f8ad767335a90aadb0.

FossilOrigin-Name: 11162446f12ae3af6e4a63bb5c374129b2505f6006f91d4028c7165f05fe9651

3 years agoEnable query invariant checking in fuzzcheck by default. There is no way
drh [Sat, 18 Jun 2022 20:20:30 +0000 (20:20 +0000)] 
Enable query invariant checking in fuzzcheck by default.  There is no way
to turn it off.  Update the invariant checking logic to be consistant with
dbsqlfuzz.

FossilOrigin-Name: 66ca729bbbf37cb7ff8eb12f51429e0c0833bd5d3f0ef20a1eaeeb10820713c2

3 years agoAbandon a query-invariant check in fuzzcheck if the call to
drh [Sat, 18 Jun 2022 14:50:43 +0000 (14:50 +0000)] 
Abandon a query-invariant check in fuzzcheck if the call to
sqlite3_bind_value() returns anything other than SQLITE_OK or SQLITE_RANGE.

FossilOrigin-Name: d31e1cd2ab44c7cce20b8990dff17719c286dd2fb46ba6d4f581a9553cf31891

3 years agoIn the --query-invariants option of fuzzcheck, correctly deal with OOMs
drh [Sat, 18 Jun 2022 10:26:12 +0000 (10:26 +0000)] 
In the --query-invariants option of fuzzcheck, correctly deal with OOMs
causing the return value of sqlite3_column_name() to be NULL.

FossilOrigin-Name: eabbee4a51bc1a865bddee890004ff3a1c9cc6b797b21f73e908642e154cef50

3 years agoFix the OP_Concat operator such that when concatenating a BLOB with an
drh [Fri, 17 Jun 2022 21:31:30 +0000 (21:31 +0000)] 
Fix the OP_Concat operator such that when concatenating a BLOB with an
odd number of bytes on a database that is UTF16, the size of the resulting
string is reduced to a multiple of two.

FossilOrigin-Name: 5eb2c23635320b76f5e1aea4d94375b847fe4b38cdb4e287fba188753f4773b1

3 years agoOmit the --query-invariants processing in fuzzcheck for queries that contain
drh [Fri, 17 Jun 2022 17:11:51 +0000 (17:11 +0000)] 
Omit the --query-invariants processing in fuzzcheck for queries that contain
the implies_nonnull_row() test function.

FossilOrigin-Name: 0602a0844893465ac2fe53c0fa648a5cbcbc6452fff6181c42fab517f047b583

3 years agoDo not run --query-invariants on statements that make use of
drh [Fri, 17 Jun 2022 16:52:54 +0000 (16:52 +0000)] 
Do not run --query-invariants on statements that make use of
sqlite_offset().

FossilOrigin-Name: c5ac4cbfb173c613d633b2c76484d735073692d001a336576174201b8f9af7b1

3 years agoVarious fixes and improvements to the --query-invariants option of
drh [Fri, 17 Jun 2022 16:39:55 +0000 (16:39 +0000)] 
Various fixes and improvements to the --query-invariants option of
fuzzcheck.

FossilOrigin-Name: 09aca89b7c26c1eb7f9df1d1cfdada18848d7c188fa7fbbcf95442dabce476ea

3 years agoAllow integers and floating point numbers to compare equal. query-invariants
drh [Fri, 17 Jun 2022 16:32:21 +0000 (16:32 +0000)] 
Allow integers and floating point numbers to compare equal.

FossilOrigin-Name: 0fe2e465ba931d4bceaf171693d2ee7af45a5f96840e65e9d4ee4a2e60f155d8

3 years agoImprove query-invariants to the point that it would have discovered the
drh [Fri, 17 Jun 2022 16:09:47 +0000 (16:09 +0000)] 
Improve query-invariants to the point that it would have discovered the
[f23a429d4153518d] bug if that bug had not already been fixed.

FossilOrigin-Name: 2a7251ed9c4c959b6df75172159c6b4445e1c2212e357d2c49ab8fa19cb3ac11

3 years agoOnly run query-invariant checks after the original query has run to completion,
drh [Fri, 17 Jun 2022 15:52:43 +0000 (15:52 +0000)] 
Only run query-invariant checks after the original query has run to completion,
so that we know it does not error-out on a subsequent row.

FossilOrigin-Name: d1fc857bb8dcd5914f5a9bbcc4efe5f4abe19a190e42e2c923b28327a95e4de6

3 years agoFix the virtual table detection mechanism to avoid false-positives that were
drh [Fri, 17 Jun 2022 15:11:31 +0000 (15:11 +0000)] 
Fix the virtual table detection mechanism to avoid false-positives that were
blocking all failures.  Then fix a few of the additional problems that are
revealed by that fix.  More fixes are needed.

FossilOrigin-Name: 42b2e6676fed1508ea0ba17c292e83134825469735700da97817c45d45c54e66

3 years agoFix the new --query-invariants option on fuzzcheck so that it does not
drh [Fri, 17 Jun 2022 12:25:33 +0000 (12:25 +0000)] 
Fix the new --query-invariants option on fuzzcheck so that it does not
use an unprotected sqlite3_value object as an argument to sqlite3_value_int64().

FossilOrigin-Name: d9f820151d74a690b5fa560597a5b3ace20165a112e1b58cb4a7c47b42745643

3 years agoAvoid omitting the rhs of FULL JOINs in cases where it is only correct to omit the...
dan [Fri, 17 Jun 2022 11:39:24 +0000 (11:39 +0000)] 
Avoid omitting the rhs of FULL JOINs in cases where it is only correct to omit the rhs of a LEFT JOIN.

FossilOrigin-Name: f23a429d4153518d37387e121f22a30b22e2b31e126ad168e72049a96be86269

3 years agoMinor fix to the query invariant testing logic of fuzzcheck.
drh [Thu, 16 Jun 2022 20:29:36 +0000 (20:29 +0000)] 
Minor fix to the query invariant testing logic of fuzzcheck.

FossilOrigin-Name: 447e62a0946f5d77b7358adcabaeb23a7012cdfbfa1ef6082734cd9b45b2699d

3 years agoMerge the latest trunk enhancements into the reuse-schema branch.
drh [Thu, 16 Jun 2022 13:57:58 +0000 (13:57 +0000)] 
Merge the latest trunk enhancements into the reuse-schema branch.

FossilOrigin-Name: 7f405fe209d141435562b69ff161a545c63c5804f7de37871d24d7b6ee80ecec

3 years agoImprovements to query invariants in fuzzcheck.
drh [Wed, 15 Jun 2022 20:18:44 +0000 (20:18 +0000)] 
Improvements to query invariants in fuzzcheck.

FossilOrigin-Name: 3a461f61b47e6ba6d5dcc2b7470ebde512b57bc68086f65050e07b06f42b7351

3 years agoImprovements to query invariant checking in fuzzcheck.
drh [Wed, 15 Jun 2022 16:26:37 +0000 (16:26 +0000)] 
Improvements to query invariant checking in fuzzcheck.

FossilOrigin-Name: 56c60a35ea457f06db58ec3f694a1ae16fd03e6625da1d7879d63d72bbcb1c62

3 years agoWhen running an incremental vacuum, detect growth in the size of the database
drh [Wed, 15 Jun 2022 14:57:04 +0000 (14:57 +0000)] 
When running an incremental vacuum, detect growth in the size of the database
file (which can only occur if the file is corrupt) and fail with SQLITE_CORRUPT.

FossilOrigin-Name: cd7a44124558ea6a43c89b1cba4402d7bf6a6ccb83be0eeb7dd01b56933bca73

3 years agoAdd the --query-invariants option to fuzzcheck. No changes to the SQLite core.
drh [Wed, 15 Jun 2022 12:50:51 +0000 (12:50 +0000)] 
Add the --query-invariants option to fuzzcheck.  No changes to the SQLite core.

FossilOrigin-Name: fef282f9fbb10967102f9676d85b8c6a3b36aff7109f1becdaeaeddef0dff4f1

3 years agoDbsqlfuzz discovered a case where a bytecode branch is in fact taken, so change
drh [Wed, 15 Jun 2022 12:32:27 +0000 (12:32 +0000)] 
Dbsqlfuzz discovered a case where a bytecode branch is in fact taken, so change
the designator from VdbeCoverageNeverTaken() to VdbeCoverage().  Test case
in TH3.

FossilOrigin-Name: 988a2a759f2b9da0e287e65306039b7a3e2b5aac3d31fe15cbb30d30ea6caf71

3 years agoAdd the --query-invariants flag to fuzzcheck. The query invariant checks are query-invariant-tests
drh [Wed, 15 Jun 2022 10:46:52 +0000 (10:46 +0000)] 
Add the --query-invariants flag to fuzzcheck.  The query invariant checks are
only run if that flag is enabled.

FossilOrigin-Name: d13b4621291831ff33cc4a8d53653eaa3f59fecf2fbc5d404db17e33a914495d

3 years agoImprovements to query invariant testing. Almost working now.
drh [Wed, 15 Jun 2022 10:37:16 +0000 (10:37 +0000)] 
Improvements to query invariant testing.  Almost working now.

FossilOrigin-Name: e039820418d64fb57cb1a8f9f21186284e6c76255a53445c5d7aef6cca89bfc4

3 years agoFix the OP_NullRow opcode so that it works even if it applied to an
drh [Tue, 14 Jun 2022 22:21:23 +0000 (22:21 +0000)] 
Fix the OP_NullRow opcode so that it works even if it applied to an
ephemeral cursor that has not yet been created.

FossilOrigin-Name: 0e925654c24774933c7738c68f704b229c68e18c8baa45f506b8d6f09164d0d8

3 years agoAdd missing SQLITE_FCNTL_SIZE_HINT call to a path taken during transaction rollback.
dan [Tue, 14 Jun 2022 21:34:13 +0000 (21:34 +0000)] 
Add missing SQLITE_FCNTL_SIZE_HINT call to a path taken during transaction rollback.

FossilOrigin-Name: 6c3266c1b4fc446c7c3a40a8816caf4f9fe0cafe4f27cdafecac61425a17927e

3 years agoAttempt to enhance fuzzcheck to do some simple invariant testing on queries.
drh [Tue, 14 Jun 2022 19:12:25 +0000 (19:12 +0000)] 
Attempt to enhance fuzzcheck to do some simple invariant testing on queries.
This is an incremental check-in for a work-in-progress.

FossilOrigin-Name: ce2d780163b3a28486904860a1815acc4169c09b971cfd199bb58d1e9a57b000

3 years agoDo not remove the EP_CanBeNull flag from expressions during a LEFT JOIN
drh [Mon, 13 Jun 2022 12:42:24 +0000 (12:42 +0000)] 
Do not remove the EP_CanBeNull flag from expressions during a LEFT JOIN
strength reduction if the query also contains a RIGHT JOIN. Fix for
the problem identified by
[forum/forumpost/b40696f50145d21c|forum post b40696f50145d21c].

FossilOrigin-Name: b1be2259e2e08ec22a88bc9a18b3ab4d83246ad4c635c05cdf80d3eff84df06a

3 years agoThe same restrictions on the use of WHERE clause terms to drive indexes
drh [Fri, 10 Jun 2022 16:41:54 +0000 (16:41 +0000)] 
The same restrictions on the use of WHERE clause terms to drive indexes
in the presence of RIGHT JOINs also apply to the use of WHERE clause terms
to manufacture automatic indexes.  This fixes a problem identified by
[forum:/forumpost/51e6959f61|forum post 51e6959f61].

FossilOrigin-Name: 342c501f532523347e6c339351e02043dd6ee9e11a291224b65ea72bd6c2ba40

3 years agofiddle: minor style tweaks, including using swapped colors for the input/output field...
stephan [Fri, 10 Jun 2022 15:43:03 +0000 (15:43 +0000)] 
fiddle: minor style tweaks, including using swapped colors for the input/output fields to help (hopefully) reduce the "which field is which?" dissonance.

FossilOrigin-Name: e25dad868f9ef2c7847319c9f6f106999ba8b0a3e09ed9edfbd25e8fc6f3c10e

3 years agoDo not allow constant propagation between WHERE-clause terms and ON-clause terms
drh [Fri, 10 Jun 2022 11:28:52 +0000 (11:28 +0000)] 
Do not allow constant propagation between WHERE-clause terms and ON-clause terms
as this can confuse RIGHT JOIN.  Fix for the problem reported by
[forum:/forumpost/8e4c352937e82929|forum post 8e4c352937e82929].

FossilOrigin-Name: cab9b4cccd13bf0ab2bc38dc9a9c04ddd34e29c65ab6aef07b6bb3c31a43bece