Commit Graph

28252 Commits

Author SHA1 Message Date
drh
9b4e7898d7 Add a test case to the fix to PRAGMA integrity_check in the previous check-in.
FossilOrigin-Name: 39a57b596d309d9e2d4c59409fe5d36e0665781ce0307d157ff8b6e883161bbb
2024-05-02 12:00:36 +00:00
drh
78bc1339ac Do not accept a string that looks like a number used as an argument to
PRAGMA integrity_check as a number.  Treat it as a table name that just
happens to look like a number.

FossilOrigin-Name: b04e7a23478f1012e501a810f3e09cca81a66e802f5f72cae80c81120174e2cb
2024-05-02 11:52:31 +00:00
drh
2ae4531c89 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
2024-05-02 11:51:26 +00:00
dan
f3ea92cceb Avoid an OP_Next in cases where an IN(...) query against a UNIQUE index may return at most 1 row.
FossilOrigin-Name: 560f64157d2fe40e107582eebb6526185c9c43305e364f4132e182dbec5b210a
2024-05-01 19:48:24 +00:00
dan
2ad1e92858 Fix another problem in the recovery extension where a corrupt sqlite_schema table could lead to excessive memory consumption.
FossilOrigin-Name: 1c7e33a8aa0e6122b5ef606e4a7d95e8ecd9440216d4b099fe8f2a40653422be
2024-05-01 16:25:46 +00:00
dan
19ca99eea4 Fix a problem causing the recovery extension to use excessive memory and CPU time in some cases.
FossilOrigin-Name: 8de85170d53e1d2a2abe14508a222377b9493e25f3174b8f0f773427deb8df26
2024-05-01 14:42:20 +00:00
dan
8d5fe073d2 Avoid 32-bit overflow when calculating ncycle for ".scanstats vm".
FossilOrigin-Name: 2858efa06d4fc7b412b892f35f5e9a766b467b4a5b74d602a030d25443f9efb4
2024-04-30 19:34:15 +00:00
drh
b11daa50f9 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
2024-04-26 19:10:15 +00:00
stephan
b95c1d0ac9 Internal JS doc touchups. No functional changes.
FossilOrigin-Name: 626b997b4e727554d7ec8b60fb37b2a94cb861a87325da4ae484bd9aa8961ca5
2024-04-26 18:42:50 +00:00
stephan
6c290ccd49 Additional internal docs in the wasm utilities.
FossilOrigin-Name: 5a2245a9ebae6d23cd343e46b9d730f66ec4d5ffc91b83ed11a0fbd2194ad807
2024-04-26 18:24:23 +00:00
dan
4c3ab545a9 Allow virtual table implementations to handle OFFSET but not LIMIT, but not LIMIT but not OFFSET.
FossilOrigin-Name: 90e5c8226a695e838e8c1703a9b8598e654d216799e8806c4d1a1f20c28c6486
2024-04-26 18:13:11 +00:00
dan
297472a2fc 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
2024-04-26 17:19:59 +00:00
drh
d3a4dbe4b8 Further fixes and improvements to the generate_series() enhancements on
this branch.

FossilOrigin-Name: b7d9bd7ee2f4100608063fdf7648f290351465d393bc876a89704f643358853e
2024-04-26 17:09:33 +00:00
drh
84a231eb61 Use hex flag masks rather than decimals in ext/misc/series.c.
FossilOrigin-Name: a94e2cd02873c283d46bf6c21d0306ad454881d7882bb167d043cc79f79a2396
2024-04-26 14:36:28 +00:00
dan
3afd5b6d65 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
2024-04-26 14:32:58 +00:00
drh
99ac2324aa Fix handling of LIMIT and OFFSET in virtual tables that are part of
a compound SELECT.

FossilOrigin-Name: 40421c1c4ed5bb1ed79ad7ee37cb5a4f0b7864c1eb94abd8ee357ab2202cad30
2024-04-26 13:38:43 +00:00
drh
317b7416a6 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
2024-04-26 13:30:48 +00:00
dan
d591a5b93d Add test demonstrating the problem at [forum:/forumpost/c243b8f856|forum post c243b8f856]. No fix yet.
FossilOrigin-Name: 1685495c0a00238c9c92cce01af8108204a2fad22433ed3e7bba3c9da9ee0766
2024-04-26 12:01:17 +00:00
drh
fed13d50a9 Fix the TreeView display of a LIMIT clause on a compound query. Debugging
code only - not part of production builds.

FossilOrigin-Name: 38f1e5ce4eedd59fbeb0a0d676d26dfe8a3313189ab9b9e4a5a1ed6721b73a14
2024-04-26 11:32:50 +00:00
drh
ec14ef80b0 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
2024-04-25 23:26:11 +00:00
drh
ddc6bd9f21 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
2024-04-25 17:52:10 +00:00
drh
23afc2c4ec 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
2024-04-25 16:55:53 +00:00
stephan
c859f0267c 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
2024-04-25 06:52:19 +00:00
drh
f8e195159f An experimental minor tweak to the way affinities are computed for compound
subqueries, when the actual affinity is ambiguous.

FossilOrigin-Name: 779723ad792ca24dd07b7a1425303c76b44bb173e718a33c26c9f7644e9912cb
2024-04-24 19:49:52 +00:00
drh
0868d58e2c 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
2024-04-24 16:36:37 +00:00
dan
dfa6289153 Fix a case where a corrupt stat4 record could go unrecognized due to integer overflow.
FossilOrigin-Name: 240a4a48b27a2b1070bba6d7da76a8df8e3f1808e262045d7ad2cf910df08f3d
2024-04-24 14:18:20 +00:00
drh
35b771e221 Add comments linking the assert() added in [cef4d9e3ba586735] to the places
where the precondition that the assert() tests are actually required.

FossilOrigin-Name: 6f0e7e195275aeb4aefd9da20348af35e3ef7f0a6b2768a34824daeace16eff1
2024-04-24 11:51:51 +00:00
dan
5b27ecafbc Avoid slowdown when exprNodeIsConstant() is called on deeply nested SQL functions.
FossilOrigin-Name: 1c0b0345451853846076467831884f951c92ec79476be40ce7f7b766fd2d8fc1
2024-04-24 11:40:47 +00:00
drh
b065eceb56 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
2024-04-24 11:21:27 +00:00
stephan
99200b2f07 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
2024-04-24 06:43:17 +00:00
drh
14602eafa7 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
2024-04-23 12:02:03 +00:00
dan
0309fb919a Fix an uninitialized variable problem in the new code on this branch.
FossilOrigin-Name: 85625b38718c6e4cf7aa97fa3c52153bd25c810b68f19e7924e1f4b709c6a05d
2024-04-23 11:56:20 +00:00
stephan
3ac612dd7d Remove some dead WASM-side code.
FossilOrigin-Name: 0a07ee27bd6021a6fc1d81133012592351530ffcf6ae09322ea74624cff910df
2024-04-23 06:49:47 +00:00
stephan
642e950e63 Minor touchups in JS docs and exception messages.
FossilOrigin-Name: 9e7fc9370dfca121244f7a2941e8de629b277f1799f8de08a43ff1d86f94b6f5
2024-04-23 06:36:28 +00:00
stephan
6e6dfd6a23 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
2024-04-23 05:38:49 +00:00
dan
46435a04fd Add extra tests for aborting conflicts in the sessions module.
FossilOrigin-Name: b4a6d32662acacb7767cfb9b8e040e6eb1f99322cb7d0cd44e6265e9ac2fb2e8
2024-04-22 20:09:17 +00:00
stephan
5d8daf184d Minor cleanups to [8fbda563d2f5].
FossilOrigin-Name: 5ee2594b657b96aea9e482a175820dcbacfa9298da45b38cf17f39ad076d3f7f
2024-04-22 17:03:52 +00:00
stephan
0a42e9913b 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
2024-04-22 16:46:37 +00:00
drh
4f2f6c74ca Extra robustness in the code that causes cursors to return NULL when they
are participating in an OUTER JOIN.

FossilOrigin-Name: 672c2869ef48e08447d37b0d76a1850cdafbe30ca1906ec98c55e3ab496fd9a6
2024-04-22 13:31:24 +00:00
stephan
2469350ad9 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
2024-04-22 11:48:03 +00:00
drh
2c26adb873 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
2024-04-22 00:42:47 +00:00
drh
db2a33a3dd Fix an indentation problem in debugging routine sqlite3ShowSrcList(). No
changes to production code.

FossilOrigin-Name: 5560df2726fed215c98d602c5f6ebbf3c5ae23f8ba1074291c509bf446fdfe66
2024-04-21 23:35:58 +00:00
dan
5749e1ee43 Slight performance improvement for the new code on this branch.
FossilOrigin-Name: 500c67f1341fe2a7e7333d525c90df201cc73a683b943ad5c1e41d4a4f639043
2024-04-20 19:19:30 +00:00
dan
d737feeacf 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
2024-04-20 15:14:06 +00:00
drh
0526db32e2 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
2024-04-18 16:11:01 +00:00
drh
06915d0145 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
2024-04-15 20:43:21 +00:00
drh
0221cacea7 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
2024-04-12 18:46:34 +00:00
drh
6f4e5ee4c9 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
2024-04-12 15:02:16 +00:00
drh
1d40237bc8 Add assert() statements to help verify the overflow page cache.
FossilOrigin-Name: 0ebc65481f4a3e7974558adea51c620a025bc0e76c0a139e549b56c5abe0cabb
2024-04-12 13:05:36 +00:00
drh
ae7ede4a4f New assert() statements to verify the correctness of the BTCF_AtLast flag
on btree cursors.

FossilOrigin-Name: 4efecd6167de71500c90b63155eba1b8567c90e9d1e282fbea54130f9ee21813
2024-04-12 12:32:09 +00:00
drh
366b419d00 Test case for the fix in the previous check-in.
FossilOrigin-Name: 0cf4d835dae260b01178e94e77be6b8a130f2031e898ef79ceba8df6c2bba58f
2024-04-12 11:28:35 +00:00
drh
c494fdb580 Mark the BTree cell overflow cache as invalid whenever the rowid goes invalid.
FossilOrigin-Name: 74c9e19c92c887012aebbe96450f6ed7a60ba22d6e3edbaa39a0f989fb7f2901
2024-04-12 02:57:52 +00:00
stephan
b6d108f0b3 Fix handling of the SQLITE_OMIT_WAL check in one place. Resolves [forum:87cc13302de160eb|forum post 87cc13302de160eb].
FossilOrigin-Name: 5dae6e6df4921f42e45c6c8de40853ab63f53a4bd1d9088a8cdac957ce62f196
2024-04-11 19:08:12 +00:00
dan
495ce22d49 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
2024-04-09 19:23:18 +00:00
dan
73a50fa42c Avoid some performance problems in the recover extension when recovering strategically corrupted databases.
FossilOrigin-Name: e66a834bbab9d71e02b70588ad4c71eae2e13b50e299b0269d488402bc4a7fc5
2024-04-09 15:09:54 +00:00
drh
d21d5b21db 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
2024-04-09 13:57:27 +00:00
dan
1278ac411c Update tests in returning1.test to account for [c7896e88].
FossilOrigin-Name: c02956cd5cbf87027ba201b5d273e0efd429836ee6cabdc2f6d5b8096c876b7b
2024-04-08 17:55:15 +00:00
drh
d59afcfbfe 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
2024-04-08 11:50:07 +00:00
drh
0389d5f8d0 Fix a harmless compiler warning in the ICU extension due to [acddbc489d5231da].
FossilOrigin-Name: 3d8750e88558f8ea6a1523a5add4ccca3262e31f348b603e56ab193d81908995
2024-04-08 11:45:15 +00:00
drh
ac94cf3ece Enhancements to the fuzzer invariant checker to turn optimizations on and
off.

FossilOrigin-Name: 67594481379824823105939fea2ce1fe280667f6db91735ac78b4b6164a78dab
2024-04-08 06:37:19 +00:00
drh
5b613ed41b Merge trunk testing enhancements into the pushdown-subquery branch.
FossilOrigin-Name: 287ff24b26a512ff7648679767e68244f6eef95df6a49c46ed1f2594030ed523
2024-04-07 18:55:57 +00:00
drh
fa4c4247a5 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
2024-04-07 18:36:32 +00:00
drh
1152def76e If SQLITE_ALLOW_ROWID_IN_VIEW is set to 2, then all rowids for views return
a value of NULL.

FossilOrigin-Name: 0a53dde21403aa6de11c5085c16def3f95046c5629daf2675b075e4d6683ef94
2024-04-07 18:23:30 +00:00
drh
660322f96f Merge trunk enhancements into the pushdown-subquery branch.
FossilOrigin-Name: 27865e316f8dfbf4c20290cf1be3024d7518fec46655e34f3fc435e15346c63e
2024-04-07 10:30:29 +00:00
drh
05c6d13027 Add comments to note the name abiguity between the MySQL push-down
optimization and the WHERE-clause push-down optimization.

FossilOrigin-Name: 3d5fb1ec7a0440072d6e3b957903c85d0f32b8b07207a1ef22d1a69cf5e664d1
2024-04-07 10:27:18 +00:00
drh
6951c49779 Do not allow changes to sqlite3ExprIsTableConstant() that support pushdown of
subqueries interfere with the hash-join logic.

FossilOrigin-Name: 8682931f9c6b40e1b09139c10bbe932c38330b5eb0c5c84f2432ad19a6793e37
2024-04-06 18:30:09 +00:00
drh
ed27183d83 Merge testing logic fixes on trunk into the pushdown-subquery branch.
FossilOrigin-Name: a4e1f03dcad70e828a4b56e7a332946daf84d6eae078e3ec9a248b8157a53963
2024-04-06 17:42:14 +00:00
drh
8181cc6c10 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
2024-04-06 17:37:30 +00:00
drh
de6a4be9b5 Generalize pushdown to allow any uncorrelated subquery to be pushed down.
FossilOrigin-Name: 87c45fb0d5f5ca5d6d1ad27bef83f294231d17d94299e1997364a7975b423e38
2024-04-06 12:19:50 +00:00
drh
743ae4c68b Experimental enhancement in which expressions of the form "expr IN table"
can be pushed down into subexpressions.

FossilOrigin-Name: 2cbd7838fd6ffdf210f34671cd2e3e749a076a3a6f155bbe5f910a67db31c5b1
2024-04-05 20:01:28 +00:00
drh
b411c4d69e 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
2024-04-05 13:56:05 +00:00
drh
65a1d7a284 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
2024-04-05 11:23:51 +00:00
stephan
7fd9b53308 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
2024-04-04 22:53:09 +00:00
drh
f895173c5f 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
2024-04-04 14:26:42 +00:00
drh
634f434686 Fix an ASAN problem in part of the test harness. No changes to SQLite itself.
FossilOrigin-Name: 797cda7ddcceb140330d58892c3e73d28df72b638df00fd48f07dfcba7706c5f
2024-04-04 13:36:48 +00:00
drh
efe9500af7 Fix test cases due to an error message change.
FossilOrigin-Name: c49ec239eddde6f07f8d528cccd6224c4c80b240dc8f5c974186e3bb08afb83b
2024-04-04 13:07:43 +00:00
stephan
13f5910889 Fix exception propagation when the opfs-sahpool VFS fails to initialize to address report in [forum:be0141c639|forum post be0141c639].
FossilOrigin-Name: cdb3a90055afe371962ec6c0931f1b08797aaeaab0358ef64b1cabda0a855b33
2024-04-04 12:36:33 +00:00
drh
307f290b32 Add an optional 3rd argument to the icu_load_collation() function that
specifies the "strength" of the comparison.

FossilOrigin-Name: acddbc489d5231dacf29890d1aa562da499026690f55c256a07d04a3190faacc
2024-04-02 21:55:45 +00:00
drh
8ce73ce15b 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
2024-04-02 14:12:29 +00:00
drh
7f7d0b19f8 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
2024-04-02 11:44:44 +00:00
drh
9352cfa30b 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
2024-04-01 15:38:15 +00:00
stephan
69dbd7a4e7 Make explicit that sqlite3_keyword_name()'s index is 0-based, per forum request. Doc changes only.
FossilOrigin-Name: 090943dc31e7a3af5c11c1c0953cb82ae3ca07ba000189bb85deaecc76921504
2024-03-30 14:11:30 +00:00
stephan
cfd4507c83 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
2024-03-28 10:58:18 +00:00
dan
6921a2d205 Update comments in fts5.h.
FossilOrigin-Name: 862945d5c432c27377e90d93d64c4655eefcc369d086eb51edef925fb3d80b57
2024-03-27 20:34:14 +00:00
dan
ed517a7082 Add extra tests to vtabL.test.
FossilOrigin-Name: fe209099f5c348f1280b9b827ffbf6a6742ebdd1a23ef189445147894b1832ba
2024-03-26 18:07:39 +00:00
dan
dcc121999c 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
2024-03-26 11:14:52 +00:00
drh
a509a90958 The RAISE() operator is not a constant expression and cannot participate in
the VALUE-as-coroutine optimization.
dbsqlfuzz 74cf7c9904360322a6c917e4934b127543d1cd51

FossilOrigin-Name: 6a06dc73847716c88d65651d1bf0e002002303881df1389beac884d0032eae08
2024-03-25 20:35:14 +00:00
dan
ca3b9096c4 Add further tests for sqlite3_declare_vtab().
FossilOrigin-Name: f3c4433f6b33087494c8d38ff9dbb008a1bd30b424ca9aaa51c1956d75a86249
2024-03-25 20:00:40 +00:00
drh
1872f8d844 Simplifications to the sqlite3_declare_vtab() implementation. Changes
some conditionals into assert() statements, for coverage.

FossilOrigin-Name: ff7b898a6f9cb9aecb51bd6b63e253b4b7486ac9367f59c3c0491d78cfb39993
2024-03-25 19:31:03 +00:00
dan
eb5bd4db91 Fix a theoretical OOB memory access in sqlite3_stmt_scanstatus_v2().
FossilOrigin-Name: 87be9580747b405c2c534beadb0f95cee0d4f34e0245f90e157a6b7ada38e092
2024-03-25 18:30:15 +00:00
drh
791b6f36cc 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
2024-03-25 18:24:28 +00:00
drh
f7aab656ff Remove an ALWAYS() from a condition that can be true.
FossilOrigin-Name: 715fcf033a6c0c64fa3076d58be8c39246aebef922c1a44a31831b40e165015e
2024-03-25 17:43:11 +00:00
drh
ed6c9aa6ab Fix an inaccuracy in automatic indexes that was exposed by the fix
at [80c4223098c1827f].

FossilOrigin-Name: fdc9406f1c8ba4a7341c1e408f6042ddc788cf65f98e1de2ee101390bfb0abae
2024-03-25 14:44:10 +00:00
drh
bcf97e70f5 Fix the pragma4.test script so that it works with SQLITE_OMIT_VIRTUALTABLE.
FossilOrigin-Name: f8fe6fb69c4164d087783a0d6990112afabea78daa4d8985eb6df7df6f45ac27
2024-03-25 13:18:46 +00:00
drh
99b4e6e254 Fix recent test case changes so that they also work on Windows.
FossilOrigin-Name: 38578b5af2e97c420f3106bc486318604aecbaa327365bbc2e9518be84491495
2024-03-25 12:28:06 +00:00
drh
41c9945c74 Use the SQLITE_CONSTRAINT return value from xBestIndex to prohibit bad
query plans in the pragma virtual table.

FossilOrigin-Name: b1259d4448f744861e416f42328c1450854370e5c77102d2a5abe5cf6c7f12bd
2024-03-25 11:34:42 +00:00
drh
4397d28378 Improvements to the vtablog.c extension: Eliminate memory leaks.
More diagnostic output for xBestIndex.

FossilOrigin-Name: 92e9a71bc4daa261d7c9a81fb66f7d7c0f0a74eb9e0c9dec8b4651acc5217bff
2024-03-25 10:55:08 +00:00
stephan
55051d661c 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
2024-03-25 10:28:10 +00:00
drh
d2b3b72a2b Improvements to the vtablog.c extension, for better logging of virtual
table interactions.

FossilOrigin-Name: e253bb36a5f4f601c9b08858b55a9ce198239ace8efa8dab7c0ec019028967c1
2024-03-25 00:38:55 +00:00
drh
cf84ae0189 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
2024-03-24 21:10:45 +00:00
drh
4a402b80c5 Improved "wheretrace" debugging output for calls to xBestIndex. No changes
to release code.

FossilOrigin-Name: 33966bb06ce9a8e90734de59a8d43c523f60870d20be64789638da4c84a8b81b
2024-03-24 20:26:59 +00:00
drh
a631eb378d Do not automatically assume that ROWID is NOT NULL when compiled with
SQLITE_ALLOW_ROWID_IN_VIEW.
dbsqlfuzz 31b38eeb63a4e1562de665078f52b7b47a7543cf

FossilOrigin-Name: 80c4223098c1827ff3a564f1f9a4203164a943e9a83eef99df68378fa3c4764b
2024-03-24 16:33:31 +00:00
drh
d9eee787bd Fix an adverse interaction between CREATE TABLE AS and the new
[/info/a120c9235f125e05|VALUES-as-coroutine] optimization.
dbsqlfuzz c2c5e7e08b7e489d270a26d895077a03f678c33b

FossilOrigin-Name: 84b6fdea0bf07c73df0ca8ef110db066164a5f34606e6c069a060476e04ef44e
2024-03-23 15:17:38 +00:00
drh
378bf82e2b Fix incorrect boundary assert()s on the new OP_IfSizeBetween opcode.
FossilOrigin-Name: 8eda4797c573382cbb989a4ab4b1f19d8fd538dbc9818d86a9aa6189cfa90f37
2024-03-22 10:32:14 +00:00
drh
2faaf3830e Test case for the assert() problem fixed by [9ba3cff9d48fe8fc].
FossilOrigin-Name: 865f0de7a17ce6059b8f0708002cff5f13b9dba3ebc41896ee0fdc21ae4f3740
2024-03-21 22:18:24 +00:00
stephan
006a9b51aa 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
2024-03-21 15:52:52 +00:00
drh
529ed1a3a3 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
2024-03-21 11:46:52 +00:00
dan
af64a22762 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
2024-03-21 11:37:36 +00:00
drh
296ae1e467 Fix all test cases so that they work with SQLITE_ALLOW_ROWID_IN_VIEW.
FossilOrigin-Name: 66c69e2f20f7692e0f34743ae97b09c4d8d11b874cdc5381795f2d1e0410f724
2024-03-21 10:35:33 +00:00
dan
219b4f2061 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
2024-03-20 16:56:12 +00:00
dan
e555bd4f02 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
2024-03-20 16:27:08 +00:00
drh
daee74c3ac 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
2024-03-20 10:45:13 +00:00
drh
7128c789bd Fix a typo in a comment.
FossilOrigin-Name: 54680d0fbec1f0575ac4be6dca866971795dab2c42b02a492d5cd485f46d153f
2024-03-20 10:40:25 +00:00
drh
697e122a11 Fix typos in the SQLITE_CONFIG_ROWID_IN_VIEW documentation.
FossilOrigin-Name: 1ad1ca498296493c8e89cda911cc153baa51c90ae6c19961841e6b4e37302a23
2024-03-20 09:45:44 +00:00
drh
254729edb7 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
2024-03-19 23:01:56 +00:00
drh
36f01f2ee3 Return the error "ambiguous column name: rowid", instead of "no such column: rowid", when a "rowid" reference is ambiguous.
FossilOrigin-Name: 0615bdae2dfc70c7e0416a28e89ffde31fa44ed4b3dac46e5ef20eed0d89e58c
2024-03-19 19:56:39 +00:00
drh
4aa21492d1 Add the --no-rowid-in-view option to the --help output of the CLI.
FossilOrigin-Name: 134da9c348a5e3b5cef97b79f37d48257afd4fa958a84f6930ac9874284a14cd
2024-03-19 19:48:50 +00:00
drh
27ea83f66e 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
2024-03-19 19:42:56 +00:00
dan
ffbe492553 Update test scripts to account for [8fcea4cd].
FossilOrigin-Name: 0c543c51a8c5c8916f649a5e7fd3fedc9c05f2df36064b1699ea6f5e08eaa9e0
2024-03-19 16:51:18 +00:00
drh
e9feb0acfc 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
2024-03-19 16:34:32 +00:00
dan
f891ef8d61 Update tests to work with SQLITE_ALLOW_ROWID_IN_VIEW.
FossilOrigin-Name: 495b8c7b08b998ddfe2ad055703f058c768e7e94014952e5cd8a81c7c1515cb1
2024-03-19 15:27:15 +00:00
dan
a10c2a9055 Return the error "ambiguous column name: rowid", instead of "no such column: rowid", when a "rowid" reference is ambiguous.
FossilOrigin-Name: 021f34fcfed41b607be8169bbda59aef93f130108d944f4741b46e8e345b2bbb
2024-03-19 14:55:49 +00:00
drh
967c303212 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
2024-03-19 14:38:39 +00:00
drh
d75bdf51c7 Improvements to the first check-in on this branch, causing less collateral
damage.

FossilOrigin-Name: 7bc882897b6910f93695ad372445df7791b096412089ccbcd4fde365c62fa074
2024-03-19 14:21:26 +00:00
drh
261c6dfe7b On second thought, change SQLITE_TESTCTRL_ROWID_IN_VIEW into a start-time
option SQLITE_CONFIG_NO_ROWID_IN_VIEW.

FossilOrigin-Name: b8e045c9e1d098d116f8745704b10ed76569d4b063c0b81cce16bc136930755d
2024-03-19 13:55:10 +00:00
drh
4b42b5259f 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
2024-03-19 13:31:54 +00:00
drh
1fe31dcfab 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
2024-03-19 10:41:18 +00:00
drh
5ed044e893 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
2024-03-19 10:16:17 +00:00
drh
108dd6a52d 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
2024-03-19 02:30:24 +00:00
dan
28cd72ac52 Fix asan problems in sqlite3rbu.c. Enable RBU for sanitizer release tests.
FossilOrigin-Name: ad2ae7717e7a10cf42aeabd3c544e7884fa082295c2babf0fdb19a684d2aba1e
2024-03-18 21:08:33 +00:00
dan
365b6e9769 Avoid spurious SQLITE_IOERR_DATA errors when reading partial pages from a cksumvfs database using a SQLITE_DIRECT_OVERFLOW_READ build.
FossilOrigin-Name: 0f485dbece9146eabe5a5c0998a9e35c685a170c3fe6d4509e92aa8dae18a2c0
2024-03-18 20:52:45 +00:00
drh
fc2d862318 Remove unnecessary blank lines from build commands in the default Makefile.in.
FossilOrigin-Name: 76fb3a908f45230b956cb659c754e47603e80aa72a2aad50d479437a9c013f61
2024-03-18 18:03:17 +00:00
drh
43a511927d 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
2024-03-18 18:00:17 +00:00
drh
2ad2584581 Fix harmless compiler (scan-build) warnings.
FossilOrigin-Name: c86f9f2a15ffc726b7f0d9bba5a8c4dfdaeea6a297e0b591c554fff3d1fe6e1c
2024-03-18 17:13:52 +00:00
drh
c195e2374b 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
2024-03-18 16:30:00 +00:00
drh
b03805b70b Change a test case to use a window function rather than random() to disable
the VALUES clause optimization.

FossilOrigin-Name: c589149a138fa0a6be3153986fc0f315e052e13ebc0e7006b6529ca02bae413b
2024-03-18 15:10:00 +00:00
drh
ac7c6f5854 Add assert() statements to validate access to the SrcItem.u1.nRow union member.
FossilOrigin-Name: 21f616d9b948efca441f8d45d0a95f4c052ce8b6daec7fa582ad9a00b82ca570
2024-03-18 13:31:24 +00:00
drh
871786b792 Fix the patch at [10ee6fcba08ab128] so that it works on reduced-size Expr
nodes.

FossilOrigin-Name: 260bd764c3f2d6d067adb9cd0045b7c24d5e00b02ab2735b1cba455a6143ff4c
2024-03-18 13:10:54 +00:00
drh
27a5ee855d Improvements to EXPLAIN QUERY PLAN output for multi-row VALUES claues.
FossilOrigin-Name: ac6f095e13e43d66c06552c8b01f6bec3407c9d41a34c4cdb0be57b0b828ad0d
2024-03-18 12:49:30 +00:00
dan
75924d3ae2 Ensure the database schema has been loaded and the database encoding gleaned before beginning to code a multi-row VALUES clause.
FossilOrigin-Name: 2ff476eb3d1f4a2146f4a48b57895a00a3ff5beb29afa679ae53ea58cac07c76
2024-03-18 11:12:22 +00:00
dan
2f4a8cc2d8 Fix a problem caused by a non-aggregate function with an OVER clause in a multi-row VALUES clause.
FossilOrigin-Name: 10ee6fcba08ab1281235197602148fe062560e1d5034a477b8e7b574dd3e2907
2024-03-18 10:54:48 +00:00
drh
54bf109e80 Omit the "noop(X)" test SQL function. Accomplish the same thing using
the idiom:  "coalesce(X,random())".

FossilOrigin-Name: 0eb2fbb8910e7a372c50db3ae44238d7b161f0e45858b74061b5228aec5fcc7e
2024-03-17 16:01:23 +00:00
drh
e4a1b4da4f Add an ALWAYS on an unreachable branch.
FossilOrigin-Name: 0dce6211690210e802545cbca9b3375e07075e117fad3f8c921879da7671d981
2024-03-17 00:13:12 +00:00
drh
1c5257dafc Recognize when an SQL function is constant and can occur inside an
optimized VALUES clause.

FossilOrigin-Name: c0e5ceb87d3cf28f22d381f863b8f91043804fd7901f23f3afb02fe698e6a12a
2024-03-16 21:12:51 +00:00
drh
ec00a4d111 A formerly impossible case has now become possible because of the new
ExprIsConstant enhancements.  So deal with that.

FossilOrigin-Name: 9ba3cff9d48fe8fc8a0a51291169599209d464465e44bdfd60058fd1e314a2b1
2024-03-16 21:04:32 +00:00
drh
7dc3e923c4 Further expand the scope of usage for the enhacement to expr-is-constant.
FossilOrigin-Name: d7eadcf7dd089f0f4aa963c58f0df32edd951368c9906375fd62b0a61cd393b8
2024-03-16 20:15:34 +00:00
drh
4713b2d73c Assert that the eCode is always non-zero upon entry into exprNodeIsConstant().
FossilOrigin-Name: f71b28f6713126745bca53e098dfe3444d4235d6a2b87ced5b333a7f0ee79be8
2024-03-16 19:48:51 +00:00
drh
b918a0f821 Activate the enhanced constant-expression for the
[constant propagation optimization](/info/f4229707ac08d66c).

FossilOrigin-Name: 92afea38881a1a4f266c79ddc6e1027cf17c288dcc8f7e7d50466899ac0054c4
2024-03-16 19:36:18 +00:00
drh
bf4105d768 Extend the scope expr-is-constant for function to cover the IN-to-EQ
optimization.

FossilOrigin-Name: dae669245c86021bcd28716aff6e316257cc8075d02081745d4b7de17f8ad553
2024-03-16 17:04:08 +00:00
dan
40514dd1f6 Fix exprNodeIsConstantFunction() so that it returns WRC_Continue, not WRC_Abort, if the function really is constant.
FossilOrigin-Name: d85dd4de2d0989127e0ae6a2eec9d83a577777f8d5ba40700084a0b498016634
2024-03-16 14:27:10 +00:00
drh
f696591dd4 Enhance the sqlite3ExprIsConstant() function so that it recognizes
constant functions.  So far the enhancement only applies to the multi-row
VALUES clause, but it could possibly be applied in many other places.

FossilOrigin-Name: c9e0488c6c0135932b6e76b0f3f3acd69ef65327e0a54daa59777f35da1aef26
2024-03-16 13:18:48 +00:00
drh
d31fc6e9cf New options for testrunner.tcl: --stop-on-error and --stop-on-coredump.
FossilOrigin-Name: 82035b9cfd28ef6b0ecc6f469f03d2b001189aa4925147cdb784b6b1964eb3b2
2024-03-15 17:57:58 +00:00
drh
825596481f Fix (totally harmless) memory leaks in Lemon to avoid warnings during ASAN
builds.

FossilOrigin-Name: ce009205a8edc02b7d45ac01bd0e692c3d2c3ffeadb68e4f1bad20c39075e692
2024-03-15 17:04:55 +00:00
drh
0ebd1c382c Tweaks to the func4.test test module (which tests the rarely used totype.c
extension) so that it works on i586 compiled using gcc-13 with -O0.  Details
at [forum:/forumpost/0a7553b0f734c033|forum post 0a7553b0f734c033].

FossilOrigin-Name: d0fbe779bc2460e120da4f39063a9f4121c700f0b86d85f4311715b1366c3515
2024-03-15 13:16:13 +00:00
drh
932b5f4575 Fix testcase to account for new behaviors with this branch.
FossilOrigin-Name: 823e579362c05bb8accf6c3b158c5162a16eb23cf81d6021c9e3246e32583d1c
2024-03-14 20:39:03 +00:00
dan
26a3ef7557 Fix a problem with ALTER TABLE and correlated multi-row VALUES clauses.
FossilOrigin-Name: d543c829ef74dbd64105bd757ca660e4f02e9ce562be4f1688a701fa535351c4
2024-03-14 19:31:06 +00:00
dan
400992b1c4 Fix a problem handling "INSERT INTO ... SELECT ... UNION VALUES(...), (...)" and similar statements.
FossilOrigin-Name: e8a2a8198a97046ff376bc5d38e4bc0a24fcac79f5a0dadb9d29d953a862a012
2024-03-14 19:01:17 +00:00
dan
f0f4323824 Avoid some OP_SCopy instructions in "INSERT INTO .. VALUES" statements that insert more than one row in cases where the VALUES clause contains a value for all columns of the table.
FossilOrigin-Name: 988f0ea70cd21b3194011e0cd1ddd4990a07669e0fd9c37afa48f69698ab7212
2024-03-14 17:04:18 +00:00
stephan
5a0fd81fce JS: remove an unused function argument and some debug-related comments. No functional changes.
FossilOrigin-Name: f15709430d4ba2fcf5729bc30a45dacb77102927b82cda12de0b67935b526cc0
2024-03-14 13:18:19 +00:00
dan
a06c046e29 Add further tests for VALUES clauses in various contexts.
FossilOrigin-Name: 973d197d9676c066a95cea77a27e36d2d7f5778283919d8cac4424d2ec952f47
2024-03-14 11:45:39 +00:00
dan
56be6f6c08 Change the way parse.y handles multi-row VALUES clauses to save a few cycles.
FossilOrigin-Name: 88d5bc91a52675d2a83748b79ad50de0e9732b2afd23107627bdc604f744d275
2024-03-13 20:04:11 +00:00
dan
aa2e244e14 Remove unreachable code from this branch.
FossilOrigin-Name: 657c7b4f9df53e041a33cfad00ee2f507ac09c97a2ae61164bd189d660d167da
2024-03-13 18:41:05 +00:00
dan
35057fb4bc Fix some OOM handling problems on this branch.
FossilOrigin-Name: 2085c7f12a3916ec883c31795e29f2e2b6641c30ecf748cce9bff7b13b061d1f
2024-03-13 17:33:45 +00:00
drh
81a244c514 Minor change to the "mdevtest" and "sdevtest" in testrunner.tcl, to make it
easier to add configurations in branches.

FossilOrigin-Name: 9349d94e05dcf266b02afcd89f1e433cdc45f23e8536b2f3f9aa242d5d89c307
2024-03-13 16:32:05 +00:00
dan
693d3867ea Merge trunk into this branch.
FossilOrigin-Name: 38635651f08d42110c01d6b24f6e362e340511846294f8696af4afc795dae80d
2024-03-13 15:47:52 +00:00
dan
e116fa153f Ensure that if a multi-row VALUES cannot be coded while being parsed, the SF_MultiValue flag is correctly set.
FossilOrigin-Name: 94791824a6f04782aac6bc16c182685e2d6ebf5c688dc9f8d59e479c6fd5a40e
2024-03-13 15:44:31 +00:00
dan
609aba00d9 Avoid creating a co-routine incrementally for a VALUES clause that has affinities other than NONE.
FossilOrigin-Name: 4229b12b327b05561dcf49b8585a66467d17d4e998b14eff65eb886f2434b53c
2024-03-13 15:34:44 +00:00
drh
6bb6a9c941 If the NJOB environment variable is a positive integer, it causes
testrunner.tcl to run that many jobs.

FossilOrigin-Name: 924281b94d8e6ba674d6fe2f7f01da890351355a854e9e6fe623fad1180f7392
2024-03-13 13:43:21 +00:00
drh
4565c8417b Document the testrunner.tcl --explain option in doc/testrunner.md.
FossilOrigin-Name: 5a7b5fc99a9d5c7693a5707c2050a8c59a8f97732e4763a56982579f8d5959ec
2024-03-13 13:27:16 +00:00
drh
4659ec34c1 Add the --explain option to testrunner.tcl.
FossilOrigin-Name: f0c9eb0326f189fe5ebbee83532ac2c413e91c6a8e9d5b93aa6170cba66fdd22
2024-03-13 13:09:58 +00:00
drh
9b6e535609 Improve one of the error messages from testrunner.tcl.
FossilOrigin-Name: 233155c174575fa99b34030c1936bc2b04489417f4d5223f18cdb3c8fc274a56
2024-03-13 11:46:23 +00:00
drh
c2764dbb33 Minor tweaks to the testrunner documentation.
FossilOrigin-Name: 3128b98d2656c7f23f6071c173f96329c7bdc49cd641050fbb7b105b810ba7c7
2024-03-13 11:29:04 +00:00
drh
484193fe7f Improvements to the "help" message generated by testrunner.tcl. Add the
special "list" permutation that does nothing but list all allowed
values for the PERMUTATION argument to testrunner.tcl.

FossilOrigin-Name: 1f5bfc6a9030f9905d258c5b665b9ff27efc7da71556c912ab3dce0f8f5aa8da
2024-03-13 10:55:47 +00:00
dan
1769640c8b Add pointer to documentation to testrunner.tcl help message.
FossilOrigin-Name: eff855102f9c0b4e9d876d1cff9d06c07de427b4880c2fa326d4d6e3e1dd13c8
2024-03-13 10:54:04 +00:00
dan
3de08a6ee0 Have testrunner.tcl set SQLITE_TMPDIR on windows as well.
FossilOrigin-Name: 64f4dad1f928716b8688c650d043f18afcc72ec78d990145c580e2b98905b919
2024-03-13 10:47:54 +00:00
drh
eea6bdce84 On testrunner.tcl: (1) Add the "help" command. (2) Add the "script" command
to the help message.  (3) Improve the error message generated by "script" when
an incorrect CONFIG option is provided.

FossilOrigin-Name: 1b7f0be44036fb90d763eabae84b95734e766f8010b39122f8787189308a7fc1
2024-03-13 00:37:37 +00:00
dan
5badd048d2 Correctly initialize the SrcItem.iCursor field to -1 when creating a co-routine from a multi-values VALUES clause.
FossilOrigin-Name: c32953ff6d72910815eaff29ab1b790c412e1a741d02c03c5911dda0c08e5130
2024-03-12 20:10:46 +00:00
dan
f99ab38bdb Have testrunner.tcl have each test store its temp files in its working directory. To avoid unlikely, but possible, collisions.
FossilOrigin-Name: 18842d0d72048561312c2c83035c01253150e1fe1ff37160f266d24d41a01df3
2024-03-12 18:33:57 +00:00
dan
3ac5c08180 Have testrunner.tcl have each test store its temp files in its working directory. To avoid unlikely, but possible, collisions.
FossilOrigin-Name: 775a10d10b9bf2227071e778718ba4054d4b2b4238751eb147338d687b4e0d58
2024-03-12 18:04:40 +00:00
dan
38152d9d04 Fix another testrunner.tcl problem on windows.
FossilOrigin-Name: 7805844bc4433ae088dae6d54eb972e082c5a3df06e844cfc8b69e7d97aeb432
2024-03-11 20:34:02 +00:00
dan
f4783d4d7f Fix a missing brace problem in testrunner.tcl introduced by the previous commit.
FossilOrigin-Name: 1f5e334d98d98cd90a2fb53502015a883d96fed05c04c1c3e1e78c302bede50f
2024-03-11 19:43:43 +00:00
dan
2dbf276e93 Update mdevtest and sdevtest to do shell builds in parallel. And only if one or more of the tcl scripts run requires it.
FossilOrigin-Name: 6eae4547d4d50c798d1f05eaa1da02f4682d261dbd64e94748179923839024e6
2024-03-11 19:33:55 +00:00
drh
c6481e0289 Run shell*.test modules with "make mdevtest".
FossilOrigin-Name: 76c471061809307c1922a9460f1ea37291ff5f4dc11a71af594351e875fdc8e3
2024-03-11 18:21:02 +00:00
dan
815e055bff Attempt to reduce the memory used by VALUES clauses in as many statements as possible, not just INSERT. This branch still has problems.
FossilOrigin-Name: 17d1f7cfabc7593d0725051b0c7c9619a23a482265f30f15ab9493fef5caeeb0
2024-03-11 17:27:19 +00:00
drh
5dfff386e5 Fix the ".import" command in the CLI so that it works correctly with tables
that contain computed columns.
[forum:/forumpost/ca014d7358|forum post ca014d7358].

FossilOrigin-Name: 95a9c88b258f18ac671a4c712603931167cc8bd0b86e41481b200c08043338b5
2024-03-11 11:24:59 +00:00
stephan
289507d78b Add more docs for the OPFS delete-before-open feature.
FossilOrigin-Name: cb8d9c269c01f78f09069a2361e15087d9aeac63e9f1fd63fbd96b951384e9aa
2024-03-11 09:39:52 +00:00
stephan
88abf9ad44 Add delete-before-open=1 URI flag to the 'opfs' VFS to tell it to xDelete the db file before opening it, primarily to enable users to work around a corrupt db without having to reach into OPFS-specific APIs to remove the db file.
FossilOrigin-Name: e87cf0d7700d33a439c91725460fbfe3a1765b48f71b4d73c38cadf6c166e0bd
2024-03-11 09:34:38 +00:00
stephan
bf030d53b1 Add delete-before-open=1 URI flag to the 'opfs' VFS to tell it to xDelete the db file before opening it, primarily to enable users to work around a corrupt db without having to reach into OPFS-specific APIs to remove the db file.
FossilOrigin-Name: e83f9788636f7f9bcca7d2a09620c13ab4eb83436d5b2946a827e48addf0267d
2024-03-11 09:32:38 +00:00
drh
5007833f5f Fix the .expert command in the shell so that it does not leak memory if not
followed by SQL and so that it works with reverse_unordered_selects.

FossilOrigin-Name: 7ead022edaf7a0cd6a8976a1261246084975c9a5be5c893f6c751bb5f963ac0f
2024-03-09 18:41:40 +00:00
drh
aa13f4c132 Fuzzcheck is run automatically by testrunner.tcl, so there is no need to
include fuzzcheck as a separate dependency for the releasetest target in
the MSVC makefile.

FossilOrigin-Name: 76629b2bff01df3d42eef2e93d626c291a2f129bd923498941465e5bca74e9f1
2024-03-09 13:31:10 +00:00
drh
61b77a6fe1 The NOT NULL strength reduction optimization from [de9c86c9e4cdb34f] should
be applied to the WHERE clause only.  Otherwise, the operand of the IS NULL
or IS NOT NULL operator might be a reference to a bare column of an
aggregate table, and we can't tell if it is NULL or not based only on its
NOT NULL attribute.  [forum:/forumpost/440f2a2f17|Forum post 440f2a2f17].

FossilOrigin-Name: 51704feae224eff601db5607f8651da11b3c2ed8a58ffe5b6ee8260cab50695b
2024-03-08 21:37:18 +00:00
drh
96f5ae6bd7 One of the assert()s added by the previous check-in was not quite correct.
This commit fixes it.

FossilOrigin-Name: d401358329f5a70f9a0b9b033609a4db2af89b83c6b40242be0c76f3d6474def
2024-03-08 19:03:30 +00:00
drh
744e5672bf Add new assert() statements, which if they had existed three years ago,
would have detected the code generator problem fixed by the previous check-in.

FossilOrigin-Name: 166d1e5d26ef88e995f44182144891f60bd51c1aa585b4a148f01a920b2a8eea
2024-03-08 15:39:59 +00:00
drh
926fb60b05 Silently ignore redundant ON CONFLICT clauses in an UPSERT. Only the first
ON CONFLICT for each index is active.  Do not issue an error, since that might
break legacy queries.  But ignore the redundant ON CONFLICT clauses to prevent
problems such as described in [forum:/forumpost/919c6579c8|forum post 919c6579c8].

FossilOrigin-Name: d0ea6b6ba64dba9d68c2b391ccf1171ea96fcdd7409dafdb2b697accb00246b8
2024-03-08 14:01:48 +00:00
dan
b89aa10cd0 Omit some extra tests for the intck extension in OMIT_VIRTUAL_TABLE or OMIT_PRAGMA builds.
FossilOrigin-Name: 29d9eb7d55755604781e507f6ca36c50d62fa8d8589ab932d7cefca94ba24f3e
2024-03-08 13:49:43 +00:00
dan
3041642b1a Fix pragma6.test so that it works with ENABLE_OVERSIZE_CELL_CHECK builds.
FossilOrigin-Name: a02551de4c2d7085569ee76f88bfef5da429e40137cc1d1349b4637f88259ad1
2024-03-08 11:13:20 +00:00
dan
a219fb5bb9 Do not run tests for the intck extension in OMIT_VIRTUAL_TABLE or OMIT_PRAGMA builds.
FossilOrigin-Name: de8130c020821a1615cceeb730423a2d6e01578caaaddeb11950363c4f8ea412
2024-03-08 11:08:53 +00:00
drh
f10de5360a Must use sqlite3IntFloatCompare() for accurate comparisons between very large
integer and floating point values in RTREE.  Otherwise the comparison does
not work on all platforms.  Further fix to [027e5336acc26f57].

FossilOrigin-Name: 820f106acff5f2cd01da0e95a0e6f2bcc087705bf8c08b730b1fdb08db5679c8
2024-03-08 03:24:09 +00:00
stephan
67fc3e0ac2 Introducing JS worker1 promiser v2, which initializes via Promise (instead of a callback function) and can be loaded as an ESM module.
FossilOrigin-Name: 2fbaf2f51d37f70ee26d45f0c62f32c15a9e03f68b6d2e2892115e7dc028b929
2024-03-07 19:29:53 +00:00
stephan
84016759dd Resolve duplicate loading of promiser v2 demo code (a side effect of having done precisely what it was told to do). Consolidate demo-worker1-promiser(-esm).html/(m)js variants into central copies processed with c-pp.
FossilOrigin-Name: 9347d9b9a69277e40ea2f3ec6e1ff37ea19d24b4af80c6230b10624173f2f17c
2024-03-07 18:53:27 +00:00