]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
5 weeks agoOmit the OP_SqlExec to "PRAGMA integrity_check" added by [348fa7aaf7958b3f]
drh [Thu, 2 May 2024 11:51:26 +0000 (11:51 +0000)] 
Omit the OP_SqlExec to "PRAGMA integrity_check" added by [348fa7aaf7958b3f]
because it is a no-op.  Even if the integrity_check failes, the CREATE TABLE
is stull successful.  The OP_SqlExec just burns CPU cycles for no reason.

FossilOrigin-Name: 532795acd1c800751737fe70148f9ae691e9cf11b836577f8538421d24cab2fe

5 weeks agoFix another problem in the recovery extension where a corrupt sqlite_schema table...
dan [Wed, 1 May 2024 16:25:46 +0000 (16:25 +0000)] 
Fix another problem in the recovery extension where a corrupt sqlite_schema table could lead to excessive memory consumption.

FossilOrigin-Name: 1c7e33a8aa0e6122b5ef606e4a7d95e8ecd9440216d4b099fe8f2a40653422be

5 weeks agoFix a problem causing the recovery extension to use excessive memory and CPU time...
dan [Wed, 1 May 2024 14:42:20 +0000 (14:42 +0000)] 
Fix a problem causing the recovery extension to use excessive memory and CPU time in some cases.

FossilOrigin-Name: 8de85170d53e1d2a2abe14508a222377b9493e25f3174b8f0f773427deb8df26

5 weeks agoAvoid 32-bit overflow when calculating ncycle for ".scanstats vm".
dan [Tue, 30 Apr 2024 19:34:15 +0000 (19:34 +0000)] 
Avoid 32-bit overflow when calculating ncycle for ".scanstats vm".

FossilOrigin-Name: 2858efa06d4fc7b412b892f35f5e9a766b467b4a5b74d602a030d25443f9efb4

6 weeks agoFix issues in [/info/1e227ad9f413227f|LIMIT/OFFSET support for virtual tables].
drh [Fri, 26 Apr 2024 19:10:15 +0000 (19:10 +0000)] 
Fix issues in [/info/1e227ad9f413227f|LIMIT/OFFSET support for virtual tables].
The first problem was reported by
[forum:/forumpost/c243b8f856|forum post c243b8f856].  That report prompted
an enhancement to the generate_series() (also included in this merge) which
in turn identified other similar issues.

FossilOrigin-Name: 5f6c079d847e3664ec5acaf1b3e989efe0d548c211ae4a18936162b36df89065

6 weeks agoInternal JS doc touchups. No functional changes.
stephan [Fri, 26 Apr 2024 18:42:50 +0000 (18:42 +0000)] 
Internal JS doc touchups. No functional changes.

FossilOrigin-Name: 626b997b4e727554d7ec8b60fb37b2a94cb861a87325da4ae484bd9aa8961ca5

6 weeks agoAdditional internal docs in the wasm utilities.
stephan [Fri, 26 Apr 2024 18:24:23 +0000 (18:24 +0000)] 
Additional internal docs in the wasm utilities.

FossilOrigin-Name: 5a2245a9ebae6d23cd343e46b9d730f66ec4d5ffc91b83ed11a0fbd2194ad807

6 weeks agoAllow virtual table implementations to handle OFFSET but not LIMIT, but not LIMIT... vtab-limit-fix
dan [Fri, 26 Apr 2024 18:13:11 +0000 (18:13 +0000)] 
Allow virtual table implementations to handle OFFSET but not LIMIT, but not LIMIT but not OFFSET.

FossilOrigin-Name: 90e5c8226a695e838e8c1703a9b8598e654d216799e8806c4d1a1f20c28c6486

6 weeks agoHave where.c ignore any plan from a virtual table that tries to use LIMIT/OFFSET...
dan [Fri, 26 Apr 2024 17:19:59 +0000 (17:19 +0000)] 
Have where.c ignore any plan from a virtual table that tries to use LIMIT/OFFSET without also using all WHERE constraints.

FossilOrigin-Name: 7d30596496c6a7a37b925f13d8d94d5de224ec31bb86594fa4cc07b10082e776

6 weeks agoFurther fixes and improvements to the generate_series() enhancements on
drh [Fri, 26 Apr 2024 17:09:33 +0000 (17:09 +0000)] 
Further fixes and improvements to the generate_series() enhancements on
this branch.

FossilOrigin-Name: b7d9bd7ee2f4100608063fdf7648f290351465d393bc876a89704f643358853e

6 weeks agoUse hex flag masks rather than decimals in ext/misc/series.c.
drh [Fri, 26 Apr 2024 14:36:28 +0000 (14:36 +0000)] 
Use hex flag masks rather than decimals in ext/misc/series.c.

FossilOrigin-Name: a94e2cd02873c283d46bf6c21d0306ad454881d7882bb167d043cc79f79a2396

6 weeks agoFix a problem allowing a LIMIT constraint to be passed to a virtual table in cases...
dan [Fri, 26 Apr 2024 14:32:58 +0000 (14:32 +0000)] 
Fix a problem allowing a LIMIT constraint to be passed to a virtual table in cases where there exist WHERE terms that cannot also be passed.

FossilOrigin-Name: 72c8ed9698dd2aadee7b84fd293e8306233f0fe5b5b5731687482444fdf461c7

6 weeks agoFix handling of LIMIT and OFFSET in virtual tables that are part of
drh [Fri, 26 Apr 2024 13:38:43 +0000 (13:38 +0000)] 
Fix handling of LIMIT and OFFSET in virtual tables that are part of
a compound SELECT.

FossilOrigin-Name: 40421c1c4ed5bb1ed79ad7ee37cb5a4f0b7864c1eb94abd8ee357ab2202cad30

6 weeks agoEnhance the generated_series() table-valued-function to respond to
drh [Fri, 26 Apr 2024 13:30:48 +0000 (13:30 +0000)] 
Enhance the generated_series() table-valued-function to respond to
LIMIT and OFFSET.  Use this to add new test cases for LIMIT and OFFSET
on virtual tables in a compound SELECT.

FossilOrigin-Name: 408d47ecaa3b906d0886f76a22b76339ec5878270ffe8d1838c74de09c29a33e

6 weeks agoAdd test demonstrating the problem at [forum:/forumpost/c243b8f856|forum post c243b8f...
dan [Fri, 26 Apr 2024 12:01:17 +0000 (12:01 +0000)] 
Add test demonstrating the problem at [forum:/forumpost/c243b8f856|forum post c243b8f856]. No fix yet.

FossilOrigin-Name: 1685495c0a00238c9c92cce01af8108204a2fad22433ed3e7bba3c9da9ee0766

6 weeks agoFix the TreeView display of a LIMIT clause on a compound query. Debugging
drh [Fri, 26 Apr 2024 11:32:50 +0000 (11:32 +0000)] 
Fix the TreeView display of a LIMIT clause on a compound query.  Debugging
code only - not part of production builds.

FossilOrigin-Name: 38f1e5ce4eedd59fbeb0a0d676d26dfe8a3313189ab9b9e4a5a1ed6721b73a14

6 weeks agoImprovement to the way that affinity is determined for columns of a
drh [Thu, 25 Apr 2024 23:26:11 +0000 (23:26 +0000)] 
Improvement to the way that affinity is determined for columns of a
compound subquery.  The affinity is the affinity of the left-most
arm of the compound subquery that has an affinity other than NONE, adjusted
to accommodate the data types coming out of the other arms.

FossilOrigin-Name: e6df846f36209bac3e420dd80ce2bbbd87ab7a20b8063fce05f78a3c7ab6027e

6 weeks agoFurther improvements to the computation of affinity for compound subqueries: compound-subquery-affinity
drh [Thu, 25 Apr 2024 17:52:10 +0000 (17:52 +0000)] 
Further improvements to the computation of affinity for compound subqueries:
make sure that the selected affinity is compatible with a literal values in
arms to the left of the arm that is used to determine affinity.

FossilOrigin-Name: bbdf22e3d989f42b963f1f2f219dfeac11db786f17ac27097ab72f72e7638a2a

6 weeks agoBack out the previous change on this branch. In its place: Determine the
drh [Thu, 25 Apr 2024 16:55:53 +0000 (16:55 +0000)] 
Back out the previous change on this branch.  In its place:  Determine the
affinity of a subquery by the left-most arm of the subquery that has an
affinity other than NONE.  In other words, scan from left to right looking
for an arm of the compound subquery with an affinity of BLOB, TEXT, INTEGER,
or REAL and pick the first one found.  Or stay with NONE if no arm has a
defined affinity.  Test cases added.

FossilOrigin-Name: b8ec8511b1968bbc1472b3e2e21f0fef1d5becebeb31f9d13ee3ca9e13abb1e5

6 weeks agowasm: add a makefile comment about the static sqlite3.h/c version info injected into...
stephan [Thu, 25 Apr 2024 06:52:19 +0000 (06:52 +0000)] 
wasm: add a makefile comment about the static sqlite3.h/c version info injected into the JS files possibly differing from the runtime-emited version info when a user provides their own sqlite3.c.

FossilOrigin-Name: d99a01a0f6e1f70f70c9a0625aeaa8a8015eba352bcfb3978eafca6df10ba5a8

6 weeks agoAn experimental minor tweak to the way affinities are computed for compound
drh [Wed, 24 Apr 2024 19:49:52 +0000 (19:49 +0000)] 
An experimental minor tweak to the way affinities are computed for compound
subqueries, when the actual affinity is ambiguous.

FossilOrigin-Name: 779723ad792ca24dd07b7a1425303c76b44bb173e718a33c26c9f7644e9912cb

6 weeks agoIf a RETURNING clause contains a subquery that references the table that is
drh [Wed, 24 Apr 2024 16:36:37 +0000 (16:36 +0000)] 
If a RETURNING clause contains a subquery that references the table that is
being updated in the statement that includes the RETURNING clause, then mark
the subquery as correlated sot hat it is recomputed for each result and not
just computed once and reused.  See
[forum:/forumpost/2c83569ce8945d39|forum post 2c83569ce8945d39].

FossilOrigin-Name: 9ea6bcc8fdf6aadb756ec5bcaaa7af314167f8973bdd32fd23f83bd964f0c21e

6 weeks agoFix a case where a corrupt stat4 record could go unrecognized due to integer overflow.
dan [Wed, 24 Apr 2024 14:18:20 +0000 (14:18 +0000)] 
Fix a case where a corrupt stat4 record could go unrecognized due to integer overflow.

FossilOrigin-Name: 240a4a48b27a2b1070bba6d7da76a8df8e3f1808e262045d7ad2cf910df08f3d

6 weeks agoAdd comments linking the assert() added in [cef4d9e3ba586735] to the places
drh [Wed, 24 Apr 2024 11:51:51 +0000 (11:51 +0000)] 
Add comments linking the assert() added in [cef4d9e3ba586735] to the places
where the precondition that the assert() tests are actually required.

FossilOrigin-Name: 6f0e7e195275aeb4aefd9da20348af35e3ef7f0a6b2768a34824daeace16eff1

6 weeks agoAvoid slowdown when exprNodeIsConstant() is called on deeply nested SQL functions.
dan [Wed, 24 Apr 2024 11:40:47 +0000 (11:40 +0000)] 
Avoid slowdown when exprNodeIsConstant() is called on deeply nested SQL functions.

FossilOrigin-Name: 1c0b0345451853846076467831884f951c92ec79476be40ce7f7b766fd2d8fc1

6 weeks agoEnsure that temporary SrcItem objects created by trigger processing have
drh [Wed, 24 Apr 2024 11:21:27 +0000 (11:21 +0000)] 
Ensure that temporary SrcItem objects created by trigger processing have
either SrcItem.zName or SrcItem.pSelect defined.  Every SrcItem should have
one or the other.

FossilOrigin-Name: cef4d9e3ba586735598f03eb5e8f29072c9e6f62b0d34ddd2fb3ed1795f6e21c

6 weeks agoRemove an undocumented feature from the JS Worker1.open API because it relies on...
stephan [Wed, 24 Apr 2024 06:43:17 +0000 (06:43 +0000)] 
Remove an undocumented feature from the JS Worker1.open API because it relies on broken behavior which has no VFS-agnostic workaround.

FossilOrigin-Name: 3a640038c70c8511e7051af83aa35d163c4f96f05c5064cffd3e4e2e63cd44a9

6 weeks agoFix a problem with vector IN operators used with an index where the affinities
drh [Tue, 23 Apr 2024 12:02:03 +0000 (12:02 +0000)] 
Fix a problem with vector IN operators used with an index where the affinities
and collations for the various vector terms are different.

FossilOrigin-Name: 86e8c782e7494377de3c27b750cd83a7eb2302c1182ee2004d3864db50fca557

6 weeks 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

6 weeks agoRemove some dead WASM-side code.
stephan [Tue, 23 Apr 2024 06:49:47 +0000 (06:49 +0000)] 
Remove some dead WASM-side code.

FossilOrigin-Name: 0a07ee27bd6021a6fc1d81133012592351530ffcf6ae09322ea74624cff910df

6 weeks agoMinor touchups in JS docs and exception messages.
stephan [Tue, 23 Apr 2024 06:36:28 +0000 (06:36 +0000)] 
Minor touchups in JS docs and exception messages.

FossilOrigin-Name: 9e7fc9370dfca121244f7a2941e8de629b277f1799f8de08a43ff1d86f94b6f5

6 weeks agoWhen running the 'dist' target in ext/wasm for an SEE-capable build, ensure that...
stephan [Tue, 23 Apr 2024 05:38:49 +0000 (05:38 +0000)] 
When running the 'dist' target in ext/wasm for an SEE-capable build, ensure that the resulting zip file and directory name include '-see'.

FossilOrigin-Name: 04c552b12e3b77b9dfd83838d35ce19a37ed024a8c18a2000ada10cf3d1eb6ad

6 weeks agoAdd extra tests for aborting conflicts in the sessions module.
dan [Mon, 22 Apr 2024 20:09:17 +0000 (20:09 +0000)] 
Add extra tests for aborting conflicts in the sessions module.

FossilOrigin-Name: b4a6d32662acacb7767cfb9b8e040e6eb1f99322cb7d0cd44e6265e9ac2fb2e8

6 weeks agoMinor cleanups to [8fbda563d2f5].
stephan [Mon, 22 Apr 2024 17:03:52 +0000 (17:03 +0000)] 
Minor cleanups to [8fbda563d2f5].

FossilOrigin-Name: 5ee2594b657b96aea9e482a175820dcbacfa9298da45b38cf17f39ad076d3f7f

6 weeks agoExtend the JS/WASM SEE build support by (A) filtering SEE-related bits out of the...
stephan [Mon, 22 Apr 2024 16:46:37 +0000 (16:46 +0000)] 
Extend the JS/WASM SEE build support by (A) filtering SEE-related bits out of the JS when not building with SEE and (B) accepting an optional key/textkey/hexkey option to the sqlite3.oo1.DB and subclass constructors to create/open SEE-encrypted databases with. Demonstrate SEE in the test app using the kvvfs. This obviates the changes made in [5c505ee8a7].

FossilOrigin-Name: 8fbda563d2f56f8dd3f695a5711e4356de79035f332270db45d4b33ed52fdfd2

6 weeks agoExtra robustness in the code that causes cursors to return NULL when they
drh [Mon, 22 Apr 2024 13:31:24 +0000 (13:31 +0000)] 
Extra robustness in the code that causes cursors to return NULL when they
are participating in an OUTER JOIN.

FossilOrigin-Name: 672c2869ef48e08447d37b0d76a1850cdafbe30ca1906ec98c55e3ab496fd9a6

6 weeks agoFor sqlite3.oo1.DB JavaScript classes, bypass execution of any on-open() SQL in SEE...
stephan [Mon, 22 Apr 2024 11:48:03 +0000 (11:48 +0000)] 
For sqlite3.oo1.DB JavaScript classes, bypass execution of any on-open() SQL in SEE-capable builds because it would necessarily run before the client has an opportunity to provide their decryption key, which would leave the db handle in an unusable state and cause the ctor to throw. This currently affects only the OPFS VFSes. We may want to consider extending the ctor options object to optionally accept an SEE key and apply it when opening the db.

FossilOrigin-Name: 5c505ee8a73f4b4a7053d98a12024d98340676f6ae9982311f9f88a9b46c8ae2

6 weeks agoContinuation of the fix at [8c0f69e0e4ae0a44]: If a viaCoroutine FROM clause
drh [Mon, 22 Apr 2024 00:42:47 +0000 (00:42 +0000)] 
Continuation of the fix at [8c0f69e0e4ae0a44]: If a viaCoroutine FROM clause
term is participating in a RIGHT or FULL JOIN, we have to create an
always-NULL pseudo-cursor for that term when processing the RIGHT join.
dbsqlfuzz 6fd1ff3a64bef4a6c092e8d757548e95698b0df5.

FossilOrigin-Name: e1040e51ebd04f2a076f477b6f240f849afb10f543ebe518e09d6842cc3cb38e

6 weeks agoFix an indentation problem in debugging routine sqlite3ShowSrcList(). No
drh [Sun, 21 Apr 2024 23:35:58 +0000 (23:35 +0000)] 
Fix an indentation problem in debugging routine sqlite3ShowSrcList().  No
changes to production code.

FossilOrigin-Name: 5560df2726fed215c98d602c5f6ebbf3c5ae23f8ba1074291c509bf446fdfe66

7 weeks 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

7 weeks 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

7 weeks 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

7 weeks 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

8 weeks 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

8 weeks 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

8 weeks 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

8 weeks 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

8 weeks 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

8 weeks 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

8 weeks 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

8 weeks 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

8 weeks 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

8 weeks 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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 months 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