]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
23 months agoFix an uninitialized variable problem in the new code on this branch. vector-in-fix
dan [Tue, 23 Apr 2024 11:56:20 +0000 (11:56 +0000)] 
Fix an uninitialized variable problem in the new code on this branch.

FossilOrigin-Name: 85625b38718c6e4cf7aa97fa3c52153bd25c810b68f19e7924e1f4b709c6a05d

23 months agoSlight performance improvement for the new code on this branch.
dan [Sat, 20 Apr 2024 19:19:30 +0000 (19:19 +0000)] 
Slight performance improvement for the new code on this branch.

FossilOrigin-Name: 500c67f1341fe2a7e7333d525c90df201cc73a683b943ad5c1e41d4a4f639043

23 months agoFix a problem where an expression like (a, b) IN (SELECT ...) might not use an index...
dan [Sat, 20 Apr 2024 15:14:06 +0000 (15:14 +0000)] 
Fix a problem where an expression like (a, b) IN (SELECT ...) might not use an index on (a, b) if the affinities and collation sequences of "a" and "b" are not identical.

FossilOrigin-Name: 4d870fd8b5450047a7486fc023d1ac9439642e8ed91eadfd5026c4cda7cc9179

2 years agoCorrect handling of OUTER JOIN when on or the other operand is a subquery
drh [Thu, 18 Apr 2024 16:11:01 +0000 (16:11 +0000)] 
Correct handling of OUTER JOIN when on or the other operand is a subquery
implemented using the VALUES-as-coroutine optimization.
dbsqlfuzz bde3bf80aedf25afa56e2997a0545a314765d3f8.

FossilOrigin-Name: 8c0f69e0e4ae0a446838cc193bfd4395fd251f3c7659b35ac388e5a0a7650a66

2 years agoThe first assert() added in [0ebc65481f4a3e79] is not necessarily true in a
drh [Mon, 15 Apr 2024 20:43:21 +0000 (20:43 +0000)] 
The first assert() added in [0ebc65481f4a3e79] is not necessarily true in a
corrupt database file.  So add a term to make it true.

FossilOrigin-Name: 6b21cccdeec92db9f6ce3dd7ea5e61b8b46650cc1e550271aa51bdc619f55b11

2 years agoIf a build fails in testrunner.tcl, do not attempt to run the jobs that
drh [Fri, 12 Apr 2024 18:46:34 +0000 (18:46 +0000)] 
If a build fails in testrunner.tcl, do not attempt to run the jobs that
depend on that build.  Instead, report those jobs as having been skipped.

FossilOrigin-Name: b40580be719a129ecd1aa3c69d1086c967d063920fdd48617c864e73c059abc1

2 years agoFixes and new tests logic to ensure that the btree overflow page cache is
drh [Fri, 12 Apr 2024 15:02:16 +0000 (15:02 +0000)] 
Fixes and new tests logic to ensure that the btree overflow page cache is
only used when it is consistent.  This resolves the malfunction observed
in [forum:/forumpost/284955a3cd454a15|forum post 284955a3cd454a15].

FossilOrigin-Name: 5dede50d9e7b6942df9f7b00fbfeaa2103c36c5da01d63d88136fb0ef4b7d26d

2 years agoAdd assert() statements to help verify the overflow page cache. btree-ovfl-cache
drh [Fri, 12 Apr 2024 13:05:36 +0000 (13:05 +0000)] 
Add assert() statements to help verify the overflow page cache.

FossilOrigin-Name: 0ebc65481f4a3e7974558adea51c620a025bc0e76c0a139e549b56c5abe0cabb

2 years agoNew assert() statements to verify the correctness of the BTCF_AtLast flag
drh [Fri, 12 Apr 2024 12:32:09 +0000 (12:32 +0000)] 
New assert() statements to verify the correctness of the BTCF_AtLast flag
on btree cursors.

FossilOrigin-Name: 4efecd6167de71500c90b63155eba1b8567c90e9d1e282fbea54130f9ee21813

2 years agoTest case for the fix in the previous check-in.
drh [Fri, 12 Apr 2024 11:28:35 +0000 (11:28 +0000)] 
Test case for the fix in the previous check-in.

FossilOrigin-Name: 0cf4d835dae260b01178e94e77be6b8a130f2031e898ef79ceba8df6c2bba58f

2 years agoMark the BTree cell overflow cache as invalid whenever the rowid goes invalid.
drh [Fri, 12 Apr 2024 02:57:52 +0000 (02:57 +0000)] 
Mark the BTree cell overflow cache as invalid whenever the rowid goes invalid.

FossilOrigin-Name: 74c9e19c92c887012aebbe96450f6ed7a60ba22d6e3edbaa39a0f989fb7f2901

2 years agoFix handling of the SQLITE_OMIT_WAL check in one place. Resolves [forum:87cc13302de16...
stephan [Thu, 11 Apr 2024 19:08:12 +0000 (19:08 +0000)] 
Fix handling of the SQLITE_OMIT_WAL check in one place. Resolves [forum:87cc13302de160eb|forum post 87cc13302de160eb].

FossilOrigin-Name: 5dae6e6df4921f42e45c6c8de40853ab63f53a4bd1d9088a8cdac957ce62f196

2 years agoFix a "shift exponent is too large" usan error that could occur in the fts3 snippet...
dan [Tue, 9 Apr 2024 19:23:18 +0000 (19:23 +0000)] 
Fix a "shift exponent is too large" usan error that could occur in the fts3 snippet() function when a query phrase contains more than 64 tokens.

FossilOrigin-Name: 6d2c7ac4ecfc1ec408cb1820985a70650d7cc5613b4b8fd1829f68ea48fce6a3

2 years agoAvoid some performance problems in the recover extension when recovering strategicall...
dan [Tue, 9 Apr 2024 15:09:54 +0000 (15:09 +0000)] 
Avoid some performance problems in the recover extension when recovering strategically corrupted databases.

FossilOrigin-Name: e66a834bbab9d71e02b70588ad4c71eae2e13b50e299b0269d488402bc4a7fc5

2 years agoThe read-only CHECK-constraint optimization of [34ddf02d3d21151b] inhibits the
drh [Tue, 9 Apr 2024 13:57:27 +0000 (13:57 +0000)] 
The read-only CHECK-constraint optimization of [34ddf02d3d21151b] inhibits the
xfer optimization for tables with CHECK constraints.  However, the xfer
optimization is required for correct operation of VACUUM INTO on tables that
contain generated columns. Fix this by ignoring CHECK constraints when
qualifying the xfer optimization while running VACUUM.  Problem reported by
[forum:/forumpost/3ec177d68fe7fa2c|forum post 3ec177d68fe7fa2c].

FossilOrigin-Name: a6e26e778812c8409fca77183e24d3b70189c4d02fce10c7e74cd4ccc8c8ea97

2 years agoUpdate tests in returning1.test to account for [c7896e88].
dan [Mon, 8 Apr 2024 17:55:15 +0000 (17:55 +0000)] 
Update tests in returning1.test to account for [c7896e88].

FossilOrigin-Name: c02956cd5cbf87027ba201b5d273e0efd429836ee6cabdc2f6d5b8096c876b7b

2 years agoEnhance the WHERE-clause push-down optimization so that it is able to
drh [Mon, 8 Apr 2024 11:50:07 +0000 (11:50 +0000)] 
Enhance the WHERE-clause push-down optimization so that it is able to
push down WHERE clause terms that contain uncorrelated subqueries.

FossilOrigin-Name: 69ec714b2d698acf9e37635256c01b233ce32f22e8323e226441d5ddd948a940

2 years agoFix a harmless compiler warning in the ICU extension due to [acddbc489d5231da].
drh [Mon, 8 Apr 2024 11:45:15 +0000 (11:45 +0000)] 
Fix a harmless compiler warning in the ICU extension due to [acddbc489d5231da].

FossilOrigin-Name: 3d8750e88558f8ea6a1523a5add4ccca3262e31f348b603e56ab193d81908995

2 years agoEnhancements to the fuzzer invariant checker to turn optimizations on and pushdown-subquery
drh [Mon, 8 Apr 2024 06:37:19 +0000 (06:37 +0000)] 
Enhancements to the fuzzer invariant checker to turn optimizations on and
off.

FossilOrigin-Name: 67594481379824823105939fea2ce1fe280667f6db91735ac78b4b6164a78dab

2 years agoMerge trunk testing enhancements into the pushdown-subquery branch.
drh [Sun, 7 Apr 2024 18:55:57 +0000 (18:55 +0000)] 
Merge trunk testing enhancements into the pushdown-subquery branch.

FossilOrigin-Name: 287ff24b26a512ff7648679767e68244f6eef95df6a49c46ed1f2594030ed523

2 years agoOmit all rowid-in-view restrictions from the fuzzinvariant.c test module
drh [Sun, 7 Apr 2024 18:36:32 +0000 (18:36 +0000)] 
Omit all rowid-in-view restrictions from the fuzzinvariant.c test module
as they are no longer necessary, as of the previous check-in.

FossilOrigin-Name: 6431538f0bb3bb8606786f3c3e5c055c4bc387098dd3bdc8a94f6fda61c47f52

2 years agoIf SQLITE_ALLOW_ROWID_IN_VIEW is set to 2, then all rowids for views return
drh [Sun, 7 Apr 2024 18:23:30 +0000 (18:23 +0000)] 
If SQLITE_ALLOW_ROWID_IN_VIEW is set to 2, then all rowids for views return
a value of NULL.

FossilOrigin-Name: 0a53dde21403aa6de11c5085c16def3f95046c5629daf2675b075e4d6683ef94

2 years agoMerge trunk enhancements into the pushdown-subquery branch.
drh [Sun, 7 Apr 2024 10:30:29 +0000 (10:30 +0000)] 
Merge trunk enhancements into the pushdown-subquery branch.

FossilOrigin-Name: 27865e316f8dfbf4c20290cf1be3024d7518fec46655e34f3fc435e15346c63e

2 years agoAdd comments to note the name abiguity between the MySQL push-down
drh [Sun, 7 Apr 2024 10:27:18 +0000 (10:27 +0000)] 
Add comments to note the name abiguity between the MySQL push-down
optimization and the WHERE-clause push-down optimization.

FossilOrigin-Name: 3d5fb1ec7a0440072d6e3b957903c85d0f32b8b07207a1ef22d1a69cf5e664d1

2 years agoDo not allow changes to sqlite3ExprIsTableConstant() that support pushdown of
drh [Sat, 6 Apr 2024 18:30:09 +0000 (18:30 +0000)] 
Do not allow changes to sqlite3ExprIsTableConstant() that support pushdown of
subqueries interfere with the hash-join logic.

FossilOrigin-Name: 8682931f9c6b40e1b09139c10bbe932c38330b5eb0c5c84f2432ad19a6793e37

2 years agoMerge testing logic fixes on trunk into the pushdown-subquery branch.
drh [Sat, 6 Apr 2024 17:42:14 +0000 (17:42 +0000)] 
Merge testing logic fixes on trunk into the pushdown-subquery branch.

FossilOrigin-Name: a4e1f03dcad70e828a4b56e7a332946daf84d6eae078e3ec9a248b8157a53963

2 years agoImprovements to the accurancy of the fuzzinvariants.c testing module when
drh [Sat, 6 Apr 2024 17:37:30 +0000 (17:37 +0000)] 
Improvements to the accurancy of the fuzzinvariants.c testing module when
SQLITE_ALLOW_ROWID_IN_VIEW is defined and the test query involves rowids.

FossilOrigin-Name: c6e873d4db3ef36a0d561e64ead6feada5d1654c0757b4b6e55f671c9db66469

2 years agoGeneralize pushdown to allow any uncorrelated subquery to be pushed down.
drh [Sat, 6 Apr 2024 12:19:50 +0000 (12:19 +0000)] 
Generalize pushdown to allow any uncorrelated subquery to be pushed down.

FossilOrigin-Name: 87c45fb0d5f5ca5d6d1ad27bef83f294231d17d94299e1997364a7975b423e38

2 years agoExperimental enhancement in which expressions of the form "expr IN table"
drh [Fri, 5 Apr 2024 20:01:28 +0000 (20:01 +0000)] 
Experimental enhancement in which expressions of the form "expr IN table"
can be pushed down into subexpressions.

FossilOrigin-Name: 2cbd7838fd6ffdf210f34671cd2e3e749a076a3a6f155bbe5f910a67db31c5b1

2 years agoCheck-in [a9657c87c53c1922] is wrong: the IndexedExpr.bMaybeNullRow flag is
drh [Fri, 5 Apr 2024 13:56:05 +0000 (13:56 +0000)] 
Check-in [a9657c87c53c1922] is wrong: the IndexedExpr.bMaybeNullRow flag is
required for virtual columns if they are part of an outer join.  Add a
test case (derived from dbsqlfuzz b9e65e2f110df998f1306571fae7af6c01e4d92b)
to prove it.

FossilOrigin-Name: 4484ec6d26b31305e31de89bdbae26344d8083a7e7de20861430d31737d9979c

2 years agoWhen compiling with SQLITE_ALLOW_ROWID_IN_VIEW, if the RETURNING clause of
drh [Fri, 5 Apr 2024 11:23:51 +0000 (11:23 +0000)] 
When compiling with SQLITE_ALLOW_ROWID_IN_VIEW, if the RETURNING clause of
an UPDATE of a view specifies a rowid, then return NULL for the value of
that rowid.  dbsqlfuzz 7863696e9e5ec10b29bcf5ab2681cd6c82a78a4a.

FossilOrigin-Name: c7896e88850669e18e89d44c4169d4f4a5d4b904bea6ccb2ac64f93b6d348a42

2 years agoOptimize sqlite3.oo1.DB.exec() for the rowMode='object' case to avoid converting...
stephan [Thu, 4 Apr 2024 22:53:09 +0000 (22:53 +0000)] 
Optimize sqlite3.oo1.DB.exec() for the rowMode='object' case to avoid converting the object property keys (column names) from native code to JS for each row. This speeds up large data sets considerably and addresses the report in [forum:3632183d2470617d|forum post 3632183d2470617d].

FossilOrigin-Name: 8b41ef8690001eb299f5b7182c28f5318333bff5b505e1d59d6e6f4556b1c759

2 years agoAdd the "interstage-heuristic" that attempts to avoid wildly inefficient
drh [Thu, 4 Apr 2024 14:26:42 +0000 (14:26 +0000)] 
Add the "interstage-heuristic" that attempts to avoid wildly inefficient
queries that use table scans instead of index lookups because the output
row estimates are inaccurate.

FossilOrigin-Name: 7bf49e2c54c9f6f336416f01c0e76aaf70f1e2f3fd612232e5a33ae5dabe0900

2 years agoFix an ASAN problem in part of the test harness. No changes to SQLite itself.
drh [Thu, 4 Apr 2024 13:36:48 +0000 (13:36 +0000)] 
Fix an ASAN problem in part of the test harness.  No changes to SQLite itself.

FossilOrigin-Name: 797cda7ddcceb140330d58892c3e73d28df72b638df00fd48f07dfcba7706c5f

2 years agoFix test cases due to an error message change.
drh [Thu, 4 Apr 2024 13:07:43 +0000 (13:07 +0000)] 
Fix test cases due to an error message change.

FossilOrigin-Name: c49ec239eddde6f07f8d528cccd6224c4c80b240dc8f5c974186e3bb08afb83b

2 years agoFix exception propagation when the opfs-sahpool VFS fails to initialize to address...
stephan [Thu, 4 Apr 2024 12:36:33 +0000 (12:36 +0000)] 
Fix exception propagation when the opfs-sahpool VFS fails to initialize to address report in [forum:be0141c639|forum post be0141c639].

FossilOrigin-Name: cdb3a90055afe371962ec6c0931f1b08797aaeaab0358ef64b1cabda0a855b33

2 years agoAdd an optional 3rd argument to the icu_load_collation() function that
drh [Tue, 2 Apr 2024 21:55:45 +0000 (21:55 +0000)] 
Add an optional 3rd argument to the icu_load_collation() function that
specifies the "strength" of the comparison.

FossilOrigin-Name: acddbc489d5231dacf29890d1aa562da499026690f55c256a07d04a3190faacc

2 years agoFix typos in comments. Provided ".wheretrace" debugging output for the interstage-heuristic
drh [Tue, 2 Apr 2024 14:12:29 +0000 (14:12 +0000)] 
Fix typos in comments.  Provided ".wheretrace" debugging output for the
interstage heuristic module.  Do omit automatic index loops in the
interstage heuristic.

FossilOrigin-Name: 186dcae19e249db36de15f295999cff25063b54ee3d5d481cd2ba99b6d13148e

2 years agoAdd a heuristic in between the two solver() passes of the query planner that
drh [Tue, 2 Apr 2024 11:44:44 +0000 (11:44 +0000)] 
Add a heuristic in between the two solver() passes of the query planner that
tries to prevent a very slow query plan in cases where the output row count
estimate is imprecise.

FossilOrigin-Name: 8018417b0143ea11535f2457bf3e4b3755717c554a17df1076425b4251b5f2c6

2 years agoImproved comments in the query planner logic that computes the cost for a
drh [Mon, 1 Apr 2024 15:38:15 +0000 (15:38 +0000)] 
Improved comments in the query planner logic that computes the cost for a
particular step in a query plan.  No code changes.

FossilOrigin-Name: 0b2ac2cdc767db764e3ea8bbc33898cac4e1ec27fe8c9b60ce08a1785f921e6d

2 years agoMake explicit that sqlite3_keyword_name()'s index is 0-based, per forum request....
stephan [Sat, 30 Mar 2024 14:11:30 +0000 (14:11 +0000)] 
Make explicit that sqlite3_keyword_name()'s index is 0-based, per forum request. Doc changes only.

FossilOrigin-Name: 090943dc31e7a3af5c11c1c0953cb82ae3ca07ba000189bb85deaecc76921504

2 years agoDocument that the order of an update hook call is unspecied vis-a-vis the final resul...
stephan [Thu, 28 Mar 2024 10:58:18 +0000 (10:58 +0000)] 
Document that the order of an update hook call is unspecied vis-a-vis the final result of the operation which triggers that hook. Doc changes only.

FossilOrigin-Name: 3d4b1f0791384d3e531d6757daecf67e5b873954de61f37032474e3ae23cd22b

2 years agoUpdate comments in fts5.h.
dan [Wed, 27 Mar 2024 20:34:14 +0000 (20:34 +0000)] 
Update comments in fts5.h.

FossilOrigin-Name: 862945d5c432c27377e90d93d64c4655eefcc369d086eb51edef925fb3d80b57

2 years agoAdd extra tests to vtabL.test.
dan [Tue, 26 Mar 2024 18:07:39 +0000 (18:07 +0000)] 
Add extra tests to vtabL.test.

FossilOrigin-Name: fe209099f5c348f1280b9b827ffbf6a6742ebdd1a23ef189445147894b1832ba

2 years agoAvoid expanding integer values in columns with real affinity to the full 8-byte repre...
dan [Tue, 26 Mar 2024 11:14:52 +0000 (11:14 +0000)] 
Avoid expanding integer values in columns with real affinity to the full 8-byte representation when editing records as part of a DROP COLUMN command.

FossilOrigin-Name: a49296de0061931badaf3db6b965131a78b1c6c21b1eeb62815ea7adf767d0b3

2 years agoThe RAISE() operator is not a constant expression and cannot participate in
drh [Mon, 25 Mar 2024 20:35:14 +0000 (20:35 +0000)] 
The RAISE() operator is not a constant expression and cannot participate in
the VALUE-as-coroutine optimization.
dbsqlfuzz 74cf7c9904360322a6c917e4934b127543d1cd51

FossilOrigin-Name: 6a06dc73847716c88d65651d1bf0e002002303881df1389beac884d0032eae08

2 years agoAdd further tests for sqlite3_declare_vtab().
dan [Mon, 25 Mar 2024 20:00:40 +0000 (20:00 +0000)] 
Add further tests for sqlite3_declare_vtab().

FossilOrigin-Name: f3c4433f6b33087494c8d38ff9dbb008a1bd30b424ca9aaa51c1956d75a86249

2 years agoSimplifications to the sqlite3_declare_vtab() implementation. Changes
drh [Mon, 25 Mar 2024 19:31:03 +0000 (19:31 +0000)] 
Simplifications to the sqlite3_declare_vtab() implementation.  Changes
some conditionals into assert() statements, for coverage.

FossilOrigin-Name: ff7b898a6f9cb9aecb51bd6b63e253b4b7486ac9367f59c3c0491d78cfb39993

2 years agoFix a theoretical OOB memory access in sqlite3_stmt_scanstatus_v2().
dan [Mon, 25 Mar 2024 18:30:15 +0000 (18:30 +0000)] 
Fix a theoretical OOB memory access in sqlite3_stmt_scanstatus_v2().

FossilOrigin-Name: 87be9580747b405c2c534beadb0f95cee0d4f34e0245f90e157a6b7ada38e092

2 years agoRevert the previous change. Instead, do a pre-check of the CREATE TABLE
drh [Mon, 25 Mar 2024 18:24:28 +0000 (18:24 +0000)] 
Revert the previous change.  Instead, do a pre-check of the CREATE TABLE
statement that is the second argument to sqlite3_declare_vtab() and if
the first two keywords are not "CREATE" and "TABLE", then raise an
SQLITE_MISUSE error.

FossilOrigin-Name: 6a2ff8351244da2336055454dfad2dd40534b7cfb51e840f7f8cf2ddacf8649e

2 years agoRemove an ALWAYS() from a condition that can be true.
drh [Mon, 25 Mar 2024 17:43:11 +0000 (17:43 +0000)] 
Remove an ALWAYS() from a condition that can be true.

FossilOrigin-Name: 715fcf033a6c0c64fa3076d58be8c39246aebef922c1a44a31831b40e165015e

2 years agoFix an inaccuracy in automatic indexes that was exposed by the fix
drh [Mon, 25 Mar 2024 14:44:10 +0000 (14:44 +0000)] 
Fix an inaccuracy in automatic indexes that was exposed by the fix
at [80c4223098c1827f].

FossilOrigin-Name: fdc9406f1c8ba4a7341c1e408f6042ddc788cf65f98e1de2ee101390bfb0abae

2 years agoFix the pragma4.test script so that it works with SQLITE_OMIT_VIRTUALTABLE.
drh [Mon, 25 Mar 2024 13:18:46 +0000 (13:18 +0000)] 
Fix the pragma4.test script so that it works with SQLITE_OMIT_VIRTUALTABLE.

FossilOrigin-Name: f8fe6fb69c4164d087783a0d6990112afabea78daa4d8985eb6df7df6f45ac27

2 years agoFix recent test case changes so that they also work on Windows.
drh [Mon, 25 Mar 2024 12:28:06 +0000 (12:28 +0000)] 
Fix recent test case changes so that they also work on Windows.

FossilOrigin-Name: 38578b5af2e97c420f3106bc486318604aecbaa327365bbc2e9518be84491495

2 years agoUse the SQLITE_CONSTRAINT return value from xBestIndex to prohibit bad
drh [Mon, 25 Mar 2024 11:34:42 +0000 (11:34 +0000)] 
Use the SQLITE_CONSTRAINT return value from xBestIndex to prohibit bad
query plans in the pragma virtual table.

FossilOrigin-Name: b1259d4448f744861e416f42328c1450854370e5c77102d2a5abe5cf6c7f12bd

2 years agoImprovements to the vtablog.c extension: Eliminate memory leaks.
drh [Mon, 25 Mar 2024 10:55:08 +0000 (10:55 +0000)] 
Improvements to the vtablog.c extension:  Eliminate memory leaks.
More diagnostic output for xBestIndex.

FossilOrigin-Name: 92e9a71bc4daa261d7c9a81fb66f7d7c0f0a74eb9e0c9dec8b4651acc5217bff

2 years agoFlag sqlite3_trace() and sqlite3_profile() as deprecated so that the doc generator...
stephan [Mon, 25 Mar 2024 10:28:10 +0000 (10:28 +0000)] 
Flag sqlite3_trace() and sqlite3_profile() as deprecated so that the doc generator for funclist.html sees them as such, and add 'Deprecated' to their page's title for consistency with other deprecated APIs. Comment changes only. Addresses [forum:0901025836|forum post 0901025836].

FossilOrigin-Name: 87c54f93f5711739741ed0ff3c1a6fe24ffc8a025b43523bf78c1f6be8c1b4cd

2 years agoImprovements to the vtablog.c extension, for better logging of virtual
drh [Mon, 25 Mar 2024 00:38:55 +0000 (00:38 +0000)] 
Improvements to the vtablog.c extension, for better logging of virtual
table interactions.

FossilOrigin-Name: e253bb36a5f4f601c9b08858b55a9ce198239ace8efa8dab7c0ec019028967c1

2 years agoFix the xBestIndex method of the pragma virtual table so that it correctly
drh [Sun, 24 Mar 2024 21:10:45 +0000 (21:10 +0000)] 
Fix the xBestIndex method of the pragma virtual table so that it correctly
gives a higher cost to plans where the schema hidden parameter is
unconstrained.  Fix for the problem reported by
[forum:/forumpost/85b6a8b6705fb77a|forum post 85b6a8b6705fb77a].

FossilOrigin-Name: bc516ff5202ee6e9834266bf755fe26e30ac557dcc7975ca7a06dfe33874fcd2

2 years agoImproved "wheretrace" debugging output for calls to xBestIndex. No changes
drh [Sun, 24 Mar 2024 20:26:59 +0000 (20:26 +0000)] 
Improved "wheretrace" debugging output for calls to xBestIndex.  No changes
to release code.

FossilOrigin-Name: 33966bb06ce9a8e90734de59a8d43c523f60870d20be64789638da4c84a8b81b

2 years agoDo not automatically assume that ROWID is NOT NULL when compiled with
drh [Sun, 24 Mar 2024 16:33:31 +0000 (16:33 +0000)] 
Do not automatically assume that ROWID is NOT NULL when compiled with
SQLITE_ALLOW_ROWID_IN_VIEW.
dbsqlfuzz 31b38eeb63a4e1562de665078f52b7b47a7543cf

FossilOrigin-Name: 80c4223098c1827ff3a564f1f9a4203164a943e9a83eef99df68378fa3c4764b

2 years agoFix an adverse interaction between CREATE TABLE AS and the new
drh [Sat, 23 Mar 2024 15:17:38 +0000 (15:17 +0000)] 
Fix an adverse interaction between CREATE TABLE AS and the new
[/info/a120c9235f125e05|VALUES-as-coroutine] optimization.
dbsqlfuzz c2c5e7e08b7e489d270a26d895077a03f678c33b

FossilOrigin-Name: 84b6fdea0bf07c73df0ca8ef110db066164a5f34606e6c069a060476e04ef44e

2 years agoFix incorrect boundary assert()s on the new OP_IfSizeBetween opcode.
drh [Fri, 22 Mar 2024 10:32:14 +0000 (10:32 +0000)] 
Fix incorrect boundary assert()s on the new OP_IfSizeBetween opcode.

FossilOrigin-Name: 8eda4797c573382cbb989a4ab4b1f19d8fd538dbc9818d86a9aa6189cfa90f37

2 years agoTest case for the assert() problem fixed by [9ba3cff9d48fe8fc].
drh [Thu, 21 Mar 2024 22:18:24 +0000 (22:18 +0000)] 
Test case for the assert() problem fixed by [9ba3cff9d48fe8fc].

FossilOrigin-Name: 865f0de7a17ce6059b8f0708002cff5f13b9dba3ebc41896ee0fdc21ae4f3740

2 years agoAdd comments (only, no code) to the JS sqlite3_config() bindings reminding us why...
stephan [Thu, 21 Mar 2024 15:52:52 +0000 (15:52 +0000)] 
Add comments (only, no code) to the JS sqlite3_config() bindings reminding us why SQLITE_CONFIG_ROWID_IN_VIEW is specifically not included. JNI does not need this treatment because it explicitly supports only a very small subset of config options.

FossilOrigin-Name: 4fea396221e84f9532f9327226691621a23bd966a860329fc579141c69cf7f64

2 years agoEnhancements to testrunner.tcl:
drh [Thu, 21 Mar 2024 11:46:52 +0000 (11:46 +0000)] 
Enhancements to testrunner.tcl:
(1) Add the "--config CONFIGS" option, to that only configuration named
on the comma-separated list CONFIGS are run.
(2) Add the "--omit CONFIGS" to omit configuration on the CONFIGS list
(3) Add the Android configuration to "release"

FossilOrigin-Name: 4ccb372967fab779b29be8f01c879a99ef247981466f81f55e18e3961fbd7d5a

2 years agoHave os_unix.c reuse cached file-descriptors in the case when a read-write fd is...
dan [Thu, 21 Mar 2024 11:37:36 +0000 (11:37 +0000)] 
Have os_unix.c reuse cached file-descriptors in the case when a read-write fd is requested on a read-only file and a read-only fd returned.

FossilOrigin-Name: a678e85402af08c1e387bf30ff2205f84dd7da749755da565d70f831c007a3d9

2 years agoFix all test cases so that they work with SQLITE_ALLOW_ROWID_IN_VIEW.
drh [Thu, 21 Mar 2024 10:35:33 +0000 (10:35 +0000)] 
Fix all test cases so that they work with SQLITE_ALLOW_ROWID_IN_VIEW.

FossilOrigin-Name: 66c69e2f20f7692e0f34743ae97b09c4d8d11b874cdc5381795f2d1e0410f724

2 years agoChange EXPLAIN QUERY PLAN output to say "USE TEMP B-TREE FOR LAST TERM OF ORDER BY...
dan [Wed, 20 Mar 2024 16:56:12 +0000 (16:56 +0000)] 
Change EXPLAIN QUERY PLAN output to say "USE TEMP B-TREE FOR LAST TERM OF ORDER BY", or "LAST N TERMS OF ORDER BY", instead of "RIGHT PART OF ORDER BY".

FossilOrigin-Name: 7e13a2c7583dbcb660adde6b0465da037365971c56726b8f18a541d8803ffeed

2 years agoChange EXPLAIN QUERY PLAN output to say "USE TEMP B-TREE FOR LAST TERM OF ORDER BY... eqp-orderby
dan [Wed, 20 Mar 2024 16:27:08 +0000 (16:27 +0000)] 
Change EXPLAIN QUERY PLAN output to say "USE TEMP B-TREE FOR LAST TERM OF ORDER BY", or "LAST N TERMS OF ORDER BY", instead of "RIGHT PART OF ORDER BY".

FossilOrigin-Name: cd547c500442f3f58c05d6da8a67c3238560c5204ea62ec14afa844cc8fb94f0

2 years agoFix the SQLITE_ALLOW_ROWID_IN_VIEW bug-compatibility option so that it works
drh [Wed, 20 Mar 2024 10:45:13 +0000 (10:45 +0000)] 
Fix the SQLITE_ALLOW_ROWID_IN_VIEW bug-compatibility option so that it works
again.  Add the SQLITE_CONFIG_ROWID_IN_VIEW sqlite3_config() value
to optionally disable the bug-compatibility mode at start-time.  Enable
testing of SQLITE_ALLOW_ROWID_IN_VIEW.

FossilOrigin-Name: b6802565df0f63286a7ef26c92d3ed817895f244920a24909cd855090fdfa08c

2 years agoFix a typo in a comment. rowid-in-view
drh [Wed, 20 Mar 2024 10:40:25 +0000 (10:40 +0000)] 
Fix a typo in a comment.

FossilOrigin-Name: 54680d0fbec1f0575ac4be6dca866971795dab2c42b02a492d5cd485f46d153f

2 years agoFix typos in the SQLITE_CONFIG_ROWID_IN_VIEW documentation.
drh [Wed, 20 Mar 2024 09:45:44 +0000 (09:45 +0000)] 
Fix typos in the SQLITE_CONFIG_ROWID_IN_VIEW documentation.

FossilOrigin-Name: 1ad1ca498296493c8e89cda911cc153baa51c90ae6c19961841e6b4e37302a23

2 years agoChange the SQLITE_CONFIG_NO_ROWID_IN_VIEW configuration option to be
drh [Tue, 19 Mar 2024 23:01:56 +0000 (23:01 +0000)] 
Change the SQLITE_CONFIG_NO_ROWID_IN_VIEW configuration option to be
just SQLITE_CONFIG_ROWID_IN_VIEW (without the "_NO_" in the middle) and give
it the ability to turn the option on and off.  Otherwise, it is difficult
to test.

FossilOrigin-Name: 5d412edc2e378999ad798d1d7d73c7f7a17ee4e3c751a0dd00b9d5ce32759550

2 years agoReturn the error "ambiguous column name: rowid", instead of "no such column: rowid...
drh [Tue, 19 Mar 2024 19:56:39 +0000 (19:56 +0000)] 
Return the error "ambiguous column name: rowid", instead of "no such column: rowid", when a "rowid" reference is ambiguous.

FossilOrigin-Name: 0615bdae2dfc70c7e0416a28e89ffde31fa44ed4b3dac46e5ef20eed0d89e58c

2 years agoAdd the --no-rowid-in-view option to the --help output of the CLI.
drh [Tue, 19 Mar 2024 19:48:50 +0000 (19:48 +0000)] 
Add the --no-rowid-in-view option to the --help output of the CLI.

FossilOrigin-Name: 134da9c348a5e3b5cef97b79f37d48257afd4fa958a84f6930ac9874284a14cd

2 years agoMake sure the new u1.nRow value is copied when making a copy of a SrcItem
drh [Tue, 19 Mar 2024 19:42:56 +0000 (19:42 +0000)] 
Make sure the new u1.nRow value is copied when making a copy of a SrcItem
object.  This fixes a problem in [ac6f095e13e43d66] from yesterady.

FossilOrigin-Name: 262f8f9d80d37160e4126634b99aa48fce2073e61f6365e8bdbe1cc4fa560a96

2 years agoUpdate test scripts to account for [8fcea4cd].
dan [Tue, 19 Mar 2024 16:51:18 +0000 (16:51 +0000)] 
Update test scripts to account for [8fcea4cd].

FossilOrigin-Name: 0c543c51a8c5c8916f649a5e7fd3fedc9c05f2df36064b1699ea6f5e08eaa9e0

2 years agoIn the name resolver when SQLITE_ALLOW_ROWID_IN_INDEX is enabled, if there
drh [Tue, 19 Mar 2024 16:34:32 +0000 (16:34 +0000)] 
In the name resolver when SQLITE_ALLOW_ROWID_IN_INDEX is enabled, if there
are multiple views that might resolve to the "rowid" but only one real table,
then use that one real table and ignore the views.

FossilOrigin-Name: 8fcea4cdfc89dd78eca5e7f62aa31aff0e296f41e79349d3af1cc3a2bc4d77c6

2 years agoUpdate tests to work with SQLITE_ALLOW_ROWID_IN_VIEW.
dan [Tue, 19 Mar 2024 15:27:15 +0000 (15:27 +0000)] 
Update tests to work with SQLITE_ALLOW_ROWID_IN_VIEW.

FossilOrigin-Name: 495b8c7b08b998ddfe2ad055703f058c768e7e94014952e5cd8a81c7c1515cb1

2 years agoReturn the error "ambiguous column name: rowid", instead of "no such column: rowid... ambiguous-rowid-error
dan [Tue, 19 Mar 2024 14:55:49 +0000 (14:55 +0000)] 
Return the error "ambiguous column name: rowid", instead of "no such column: rowid", when a "rowid" reference is ambiguous.

FossilOrigin-Name: 021f34fcfed41b607be8169bbda59aef93f130108d944f4741b46e8e345b2bbb

2 years agoFix the fuzzinvariants.c test module so that it does not generate
drh [Tue, 19 Mar 2024 14:38:39 +0000 (14:38 +0000)] 
Fix the fuzzinvariants.c test module so that it does not generate
invariants that depend on rowid when SQLITE_ALLOW_ROWID_IN_VIEW is used,
since rowid values can be unreliable in that context.

FossilOrigin-Name: 0d711aaaa14472a82f8893e1b07d845073f3d018bd5b8093ec0b00ffbbc8cd5a

2 years agoImprovements to the first check-in on this branch, causing less collateral
drh [Tue, 19 Mar 2024 14:21:26 +0000 (14:21 +0000)] 
Improvements to the first check-in on this branch, causing less collateral
damage.

FossilOrigin-Name: 7bc882897b6910f93695ad372445df7791b096412089ccbcd4fde365c62fa074

2 years agoOn second thought, change SQLITE_TESTCTRL_ROWID_IN_VIEW into a start-time
drh [Tue, 19 Mar 2024 13:55:10 +0000 (13:55 +0000)] 
On second thought, change SQLITE_TESTCTRL_ROWID_IN_VIEW into a start-time
option SQLITE_CONFIG_NO_ROWID_IN_VIEW.

FossilOrigin-Name: b8e045c9e1d098d116f8745704b10ed76569d4b063c0b81cce16bc136930755d

2 years agoWhen compiled with SQLITE_ALLOW_ROWID_IN_VIEW, rowid-in-view is on by default
drh [Tue, 19 Mar 2024 13:31:54 +0000 (13:31 +0000)] 
When compiled with SQLITE_ALLOW_ROWID_IN_VIEW, rowid-in-view is on by default
but can now be turned off using SQLITE_TESTCTRL_ROWID_IN_VIEW.  Without the
compile-time option, rowid-in-view is always off.

FossilOrigin-Name: 8a6196ab29052071be753c5c77ac945c2d62ecc8019c6160f954eafe34ab05a8

2 years agoAdjustments to the test cases for the previous check-in to make them
drh [Tue, 19 Mar 2024 10:41:18 +0000 (10:41 +0000)] 
Adjustments to the test cases for the previous check-in to make them
cross-platform Linux/Mac/Windows.  Test chance only.  No change to core code.

FossilOrigin-Name: 0dddadbd5b217a48bb5c1b0568a03fbafb89dba98c577727bf4f79ff7e0ca849

2 years agoFix another problem from [c63e26e705f5e967] involving infinities and the
drh [Tue, 19 Mar 2024 10:16:17 +0000 (10:16 +0000)] 
Fix another problem from [c63e26e705f5e967] involving infinities and the
Kahan-Babushka-Neumaier summation algorithm.  Problem reported by
[forum:/forumpost/23b8688ef4|forum post 23b8688ef4].

FossilOrigin-Name: 45d272ef38d5ee6189f81369aefb8e3ac35868a67687012d93c84f2bbc42520a

2 years agoFirst steps toward getting -DSQLITE_ALLOW_ROWID_IN_VIEW to work again. That
drh [Tue, 19 Mar 2024 02:30:24 +0000 (02:30 +0000)] 
First steps toward getting -DSQLITE_ALLOW_ROWID_IN_VIEW to work again.  That
compile-time option is untested, undocumented, and unsupported.  But it was
mentioned in the release notes for version 3.36.0, so I think that means we
need to support it forever.

FossilOrigin-Name: 7c46ff640247584f1ea260c062de29a0e49f649d1894a526574c1a479006a1fc

2 years agoFix asan problems in sqlite3rbu.c. Enable RBU for sanitizer release tests.
dan [Mon, 18 Mar 2024 21:08:33 +0000 (21:08 +0000)] 
Fix asan problems in sqlite3rbu.c. Enable RBU for sanitizer release tests.

FossilOrigin-Name: ad2ae7717e7a10cf42aeabd3c544e7884fa082295c2babf0fdb19a684d2aba1e

2 years agoAvoid spurious SQLITE_IOERR_DATA errors when reading partial pages from a cksumvfs...
dan [Mon, 18 Mar 2024 20:52:45 +0000 (20:52 +0000)] 
Avoid spurious SQLITE_IOERR_DATA errors when reading partial pages from a cksumvfs database using a SQLITE_DIRECT_OVERFLOW_READ build.

FossilOrigin-Name: 0f485dbece9146eabe5a5c0998a9e35c685a170c3fe6d4509e92aa8dae18a2c0

2 years agoRemove unnecessary blank lines from build commands in the default Makefile.in.
drh [Mon, 18 Mar 2024 18:03:17 +0000 (18:03 +0000)] 
Remove unnecessary blank lines from build commands in the default Makefile.in.

FossilOrigin-Name: 76fb3a908f45230b956cb659c754e47603e80aa72a2aad50d479437a9c013f61

2 years agoAdd the "VALUES-as-coroutine" optimization. Large VALUES clauses on an
drh [Mon, 18 Mar 2024 18:00:17 +0000 (18:00 +0000)] 
Add the "VALUES-as-coroutine" optimization.  Large VALUES clauses on an
INSERT, for example, prepare and run in about half the time and with half
the memory.  This check-in also includes enhancements to the internal
sqlite3ExprIsConstant() routine to recognize pure SQL functions as constant
if they have constant arguments.

FossilOrigin-Name: a120c9235f125e05be494038c16a9dd326fd79837698bef17e7879cd0cd75831

2 years agoFix harmless compiler (scan-build) warnings. exp-values-clause2
drh [Mon, 18 Mar 2024 17:13:52 +0000 (17:13 +0000)] 
Fix harmless compiler (scan-build) warnings.

FossilOrigin-Name: c86f9f2a15ffc726b7f0d9bba5a8c4dfdaeea6a297e0b591c554fff3d1fe6e1c

2 years agoAllow the VALUES-as-coroutine optimization to be applied to later rows of
drh [Mon, 18 Mar 2024 16:30:00 +0000 (16:30 +0000)] 
Allow the VALUES-as-coroutine optimization to be applied to later rows of
a VALUES clause even if earlier rows do not qualify.

FossilOrigin-Name: 9a47ea7f0f675f7bf4710901487ce34c7689e618cd1d8b9f94f0ff7ebc3f2841

2 years agoChange a test case to use a window function rather than random() to disable
drh [Mon, 18 Mar 2024 15:10:00 +0000 (15:10 +0000)] 
Change a test case to use a window function rather than random() to disable
the VALUES clause optimization.

FossilOrigin-Name: c589149a138fa0a6be3153986fc0f315e052e13ebc0e7006b6529ca02bae413b

2 years agoAdd assert() statements to validate access to the SrcItem.u1.nRow union member.
drh [Mon, 18 Mar 2024 13:31:24 +0000 (13:31 +0000)] 
Add assert() statements to validate access to the SrcItem.u1.nRow union member.

FossilOrigin-Name: 21f616d9b948efca441f8d45d0a95f4c052ce8b6daec7fa582ad9a00b82ca570

2 years agoFix the patch at [10ee6fcba08ab128] so that it works on reduced-size Expr
drh [Mon, 18 Mar 2024 13:10:54 +0000 (13:10 +0000)] 
Fix the patch at [10ee6fcba08ab128] so that it works on reduced-size Expr
nodes.

FossilOrigin-Name: 260bd764c3f2d6d067adb9cd0045b7c24d5e00b02ab2735b1cba455a6143ff4c

2 years agoImprovements to EXPLAIN QUERY PLAN output for multi-row VALUES claues.
drh [Mon, 18 Mar 2024 12:49:30 +0000 (12:49 +0000)] 
Improvements to EXPLAIN QUERY PLAN output for multi-row VALUES claues.

FossilOrigin-Name: ac6f095e13e43d66c06552c8b01f6bec3407c9d41a34c4cdb0be57b0b828ad0d

2 years agoEnsure the database schema has been loaded and the database encoding gleaned before...
dan [Mon, 18 Mar 2024 11:12:22 +0000 (11:12 +0000)] 
Ensure the database schema has been loaded and the database encoding gleaned before beginning to code a multi-row VALUES clause.

FossilOrigin-Name: 2ff476eb3d1f4a2146f4a48b57895a00a3ff5beb29afa679ae53ea58cac07c76

2 years agoFix a problem caused by a non-aggregate function with an OVER clause in a multi-row...
dan [Mon, 18 Mar 2024 10:54:48 +0000 (10:54 +0000)] 
Fix a problem caused by a non-aggregate function with an OVER clause in a multi-row VALUES clause.

FossilOrigin-Name: 10ee6fcba08ab1281235197602148fe062560e1d5034a477b8e7b574dd3e2907