Commit Graph

22772 Commits

Author SHA1 Message Date
dan
d73ade7d87 Fix issue with failing --enable-debug --enable-fts5 build.
FossilOrigin-Name: e7491acc0c93b7b0b5a27130d956bb23f876b90ced11cdd416a86727af076ee1
2021-04-06 17:51:18 +00:00
drh
4ffaffe657 New test cases added to fuzzdata8.db.
FossilOrigin-Name: 039ad662dd899048da04238c05b8cf384323f6e8c1087b96428ea9e20726c8c0
2021-04-06 16:55:30 +00:00
dan
11fbee24b6 Silence an msan warning triggered by a corrupt database by initializing a local variable in sqlite3Insert().
FossilOrigin-Name: f64deecee1691cf21b4f3d27d8490ecc8eae65cf26df7a22f8d15317f0cecd5b
2021-04-06 16:42:05 +00:00
dan
d4b646997a Avoid a use-after-free that may occur when accessing a corrupt database schema with "PRAGMA writable_schema = 1" set.
FossilOrigin-Name: a1d823f6879ce1acfd251de35ffdfdf5ce7d8e0552205c2c4a1fee179e3a6972
2021-04-06 16:16:15 +00:00
dan
f22c590bab Remove some test routines from release builds of fts5.
FossilOrigin-Name: 3088bf15ca53fac3bad94f241e648836631b6d801d42837c238ff27d85074ca4
2021-04-06 14:46:50 +00:00
dan
1408bf176e Fix incorrect RETURNING test cases in wherelimit.test
FossilOrigin-Name: 20d21ff9be558c5f7773efa4efba7d36752f56c9a0caf1fd9c601aab5562dcef
2021-04-06 13:57:23 +00:00
drh
d22ecfd38c Earlier detection of OOM errors during window function processing.
dbsqlfuzz b08676f5a0437552c95d2a5d7ef285f8c451ea35.

FossilOrigin-Name: 8e04f52e32c9655b703ab0a6dc6d57e6bd134db9e7168807b7b2ce81974f9274
2021-04-06 13:56:46 +00:00
dan
2a1aeaa36e Handle "RETURNING rowid" clauses attached to INSERTs on views without causing an assert() to fail. Fixes dbsqlfuzz crash 0081f863d7b2002045ac2361879fc80dfebb98f1.
FossilOrigin-Name: 9c5b7386d013a7f22a93c69722c4648e2ab60eef180f48b5470bfea6fa74b3da
2021-04-06 13:53:10 +00:00
drh
8119aab3c8 Further improvements (subsequent to [d91450847a3a3a72]) to handling of attempts
to delete a journal using the memdb VFS.
dbsqlfuzz ac61dab357279a6a531de067f040e9a4828d2df0.

FossilOrigin-Name: a0839406426a0d8ec52cc3116ea7d8b582344b44f3f8c9365bbf5187370c3386
2021-04-06 13:03:06 +00:00
drh
4c4a25727f Earlier detection and handling of OOM problems.
dbsqlfuzz 39f2963ea5559aa3a16e24e0e3cb42aac85a7371.

FossilOrigin-Name: 8d46df73132e46abb32b9dc129b6beb978d34dac3d372fb004ca283b0832d04c
2021-04-06 12:50:24 +00:00
drh
e0cc26734e Relax an assertion on the sqlite3WhereEnd() routine after dbsqlfuzz found
a counter-example.

FossilOrigin-Name: e6b591e76523034c41884b39d71d4b721f1df709bdafd842e2d4b4084c158ec0
2021-04-05 22:42:15 +00:00
drh
9ce612a66f Add a missing CORRUPT_DB to an assert in the OP_ResultRow opcode.
FossilOrigin-Name: 82f92d79e1901911b0ce57d0aa30d462847748159443c7db8af16e6b37e8212c
2021-04-05 22:30:56 +00:00
drh
7ac08e8be6 Adjust the README.md file so that build instructions work for Fossil version
2.12 and later.  [forum:/forumpost/51f28bb701|Forum post 51f28bb701].

FossilOrigin-Name: 51f87adc7f90935484eadad82f751f1df8c1607d463dae9589a71aeda2184b3a
2021-04-05 19:23:18 +00:00
dan
6b6ec407ab Do not allow floating point rounding errors to cause a window function xInverse() function to be invoked before the corresponding xStep() call.
FossilOrigin-Name: 7a19fed4f222bc6c20e13a1367c8235916d21ba5e6f5a31cd26842efe748e744
2021-04-05 19:05:18 +00:00
drh
e3814ee026 Fix an assert() that can be false when doing an incremental vacuum on a
corrupt database file.  dbsqlfuzz cced0668cfd4da4eb2382cb9dd26c17c64aaff76.

FossilOrigin-Name: 15b801016fa204b8e4b7c89e236adb73dd57687959d825664de5097370b24030
2021-04-05 17:50:38 +00:00
dan
240e36c0e3 Avoid coding unindexed WHERE constraints if an equivalent transitive term has already been coded by an outer loop.
FossilOrigin-Name: 644bb77f8bb2c3499db7c280440c92fd2649a98ce714ae0d5d690eabfdc04326
2021-04-05 16:20:59 +00:00
drh
d5e7fff2ca Do not invoke the xDelete method when converting to PRAGMA journal_mode=OFF
if the underlying VFS does not support that method.
dbsqlfuzz 39d6af88ef5242f866c4f9b21ede330c5c1e36a8.

FossilOrigin-Name: d91450847a3a3a7217f8f5947adea9a4d12cf77607d40f9724d6ba093919b524
2021-04-05 13:41:42 +00:00
drh
2389048f29 As a continuation of [1f66a85b7757754f], ensure that an OOM that occurs
while checking the validity of the schema is reported out as SQLITE_NOMEM
and not as SQLITE_SCHEMA.

FossilOrigin-Name: 5045c8a748f0065638d0ff4f6e3ccd124183fbc518cb9b0418d125b04dbc1491
2021-04-05 11:39:55 +00:00
drh
319deefdb9 Fix an assert() in sqlite3BtreeLast() that needs an "|| CORRUPT_DB" term.
Dbsqlfuzz case b92b72e4de80b5140c30ab71372ca719b8feb618.

FossilOrigin-Name: ad718388a1f6e25ceba43a40160fac0d9d9d3f26888e98d7b9db478c0b1780be
2021-04-04 23:56:15 +00:00
larrybr
b0e62b0a21 Avoid compile error when SQLITE_OMIT_VIRTUALTABLE defined.
FossilOrigin-Name: 0ee0ef476ba9e17794c088a1347a136df3eb1ef864da884cfe81e3b2e94e9719
2021-04-04 14:22:02 +00:00
larrybr
dabada6020 Make shell .parameter feature type-agnostic. Hush harmless compiler warning.
FossilOrigin-Name: 35cf295e026d067c9f059fde6b150e65163fe171d37501eb1e5742e691793340
2021-04-04 12:52:58 +00:00
drh
57f90189a5 Improved robustness to OOM conditions in the window function logic.
dbsqlfuzz 0c123f7d80b29beaafc8411c12129e46f7ffdac3.

FossilOrigin-Name: 35ff7cbf547d41109b7cd4217a5439b3b4a1a4c310309c572c88f596fbc1b099
2021-04-03 23:30:33 +00:00
drh
ad3930be46 Take care not to change an SQLITE_NOMEM error into SQLITE_SCHEMA.
FossilOrigin-Name: 1f66a85b7757754ff9aa0a626f66250c5fabc5fc8ab67bbc4b2ae8e6d9231a72
2021-04-03 20:35:08 +00:00
dan
f330d53ff3 Fix a crash in handling queries of the form "SELECT aggregate(DISTINCT tbl.col) FROM ... LEFT JOIN tbl ...". Fixes a problem introduced by [ef4ac0ddd297bbd3].
FossilOrigin-Name: 0dcf808ddf23da834da724d88b1715ed06565f1f1290713ff42a3fcf6ffb802e
2021-04-03 19:23:59 +00:00
drh
9af69ff547 Correctly capture the error when a RETURNING clause appears on an
attempt to UPDATE an eponymous virtual table.
dbsqlfuzz 486f791cbe2dc45839310073e71367a1d8ad22dd.

FossilOrigin-Name: 778a9a6e6f8d960fd55ac9be7eea20b1875a46192db85e63dddc61b632b30173
2021-04-02 20:43:26 +00:00
dan
aecc04d642 Add experimental SQLITE_FCNTL_EXTERNAL_READER file control.
FossilOrigin-Name: e16da5af822ef31d7e05992403cf9787fbb3d9abb0b5283aba55ea07e1830a72
2021-04-02 19:55:48 +00:00
drh
ec435c40ed Fix a problem with the geopoly_bbox() function.
FossilOrigin-Name: f3a2eb979f1003e8249e613b34afd345f157c0d54b4f05ea0db230ef70e71351
2021-04-02 18:59:13 +00:00
drh
22af584e3e When resolving names in the RETURNING clause, do not accept trigger names
even within subquires.  See
[forum:/info/34c81d83c9177f46|forum post 34c81d83c9177f46] for context.

FossilOrigin-Name: fd4ea3f626b6e4957d56c2369be711895735cfc37cfde65650a6682ad5a3eb1a
2021-03-31 23:56:55 +00:00
drh
d75aeee535 When resolving column names in the RETURNING clause, do not ignore an
incorrect table name qualifier.  Raise an error instead.
See [forum:forumpost/85aef8bc01|forum post 85aef8bc01] for context.

FossilOrigin-Name: 51d5c50b2fb373e4c7ddb7e26657c26ad39dc9c2fc629bba5c2522b4150d8fac
2021-03-31 17:42:24 +00:00
drh
b3ad4e6118 Defer deletion of expressions that are optimized out by the AND optimizer
in the sqlite3ExprAnd() routine until the corresponding Parse object is
deleted.  This avoids a dangling pointer in AggInfo if sqlite3ExprAnd()
is invoked by the push-down optimization.  The dangling pointer appears
to be harmless in release builds, only showing up in debug builds.
Problem found by dbsqlfuzz.

FossilOrigin-Name: c36b43589abd9f62a709bdb47b8748e0c1e8743487a3d83d1eb35eb06b65d763
2021-03-31 13:31:33 +00:00
dan
b03786ad6e Ensure that negative numbers may not be used in frame offset clauses even if they are initially text value. e.g. (RANGE BETWEEN '-1' PRECEDING ...).
FossilOrigin-Name: 8b681b274dd01c3e0f76d5bbddcbb2450c6d9475b9cfa0db961a3ab5edf51db1
2021-03-31 11:31:19 +00:00
drh
0d23f678b1 Raise an error if a term of the form "TABLE.*" appears in the RETURNING clause,
as SQLite does not (yet) know how to handle that.
Ticket [132994c8b1063bfb].

FossilOrigin-Name: 3039bcaff95bb5d096c80b5eefdaeda6abd1d1337e829f32fd28a968f663f481
2021-03-30 01:52:21 +00:00
dan
28a314e74d Do not do the EXISTS-to-IN transformation if the sub-select has LIMIT clause.
FossilOrigin-Name: d07e246f9b6d4d7aef63a6debcb7ab2832bff6f80a245f50bcebb3f8de1bacc7
2021-03-29 20:28:27 +00:00
dan
acbae3ba10 Add "#ifdef SQLITE_DEBUG" blocks around test variables sqlite3_fts5_may_be_corrupt and sqlite3_fts3_may_be_corrupt.
FossilOrigin-Name: 004559544e661f9afa60306c4ac6842c29a8630b3663d62aa0cdc637f176932e
2021-03-29 20:04:31 +00:00
drh
269b7d09bd Simplify the comparison opcodes in the bytecode engine, for a performance
improvement.

FossilOrigin-Name: f2af5868be83c65dbc593dafd4357fdb7d5d740128e9225dd1b2de16947012b3
2021-03-29 20:01:04 +00:00
drh
529df929de Fix VDBE coverage macros.
FossilOrigin-Name: ebe100de55ccdf6abccde5d8e6e96099b6e8dc3527f1441265e2b86b6661a66b
2021-03-29 19:47:39 +00:00
drh
4bc20452b5 Omit the SQLITE_STOREP2 and SQLITE_KEEPNULL options from the comparison
opcodes, allowing them to run faster.  This required refactoring the
vector comparison logic, which in turn required changing OP_ElseNotEq into
OP_ElseEq.

FossilOrigin-Name: 380b46054b6a9b67e57357815e8e94057253fa3cce838ae76e5d5031c6bd26b2
2021-03-29 18:53:47 +00:00
drh
871e7ff43d Add the OP_ZeroOrNull opcode and use it to compute boolean values for
scalar comparisons, rather than the SQLITE_STOREP2 parameter to the comparison
opcode.

FossilOrigin-Name: 93781b6f10a94fb273204b95156a8b90e07071f28c89e7966c659a0f44f60e98
2021-03-29 14:40:48 +00:00
drh
1f97d2618b The comparison opcodes (ex: OP_Eq) now set the iCompare flag so that the
result of comparison can be used by subsequent OP_Jump or OP_ElseNotEq
opcodes.

FossilOrigin-Name: bd00df8f07b7163b0712590d2bb517e838a36c994dc47d7b39b5a07d14e6e6af
2021-03-29 13:47:20 +00:00
drh
1af3fd562f Alternative implementation of the comparison opcode speed-up of
check-in [4a8805d9a66dc888] that should pass muster with UBSAN.

FossilOrigin-Name: afb18f64541effaeaada2d72c7c91adfe5ec3e2b1418c0bc281083125fb5badb
2021-03-28 23:37:56 +00:00
drh
9cffb0ffb9 Document the "%token" directive for Lemon. This directive has been in place
for a while, but was previously undocumented.

FossilOrigin-Name: 36624d3740a8d095eee061bcc5037deabddb88a53444ec1a956a8af7684efa43
2021-03-28 20:44:01 +00:00
drh
5e23ae500b For the sqlite3_bind_text16 TCL binding used for testing, ensure that there
are at least 3 terminating zeros, so that there will always be a \u0000
character even if the original byte sequence is an odd number of bytes.

FossilOrigin-Name: c23d092f37c535f88a47e9f55aa7b2fd40cfd5c50eec9191a68073d7f9141ecd
2021-03-27 16:21:34 +00:00
drh
639ae98c63 In the sqlite3_bind_text and sqlite3_bind_text16 TCL commands of the test
suite, ensure that the string is zero-terminated if the size argument is
negative.

FossilOrigin-Name: f472fd64434cb2eac169587faa34bec489bc82002d529bc72dbfbba5251e5517
2021-03-26 23:59:37 +00:00
drh
126aab142e Remove old testcases() macros. Also remove surplus end-of-line whitespace.
FossilOrigin-Name: 54b41915ed8ef993b4116b2de00f3f4bba7570a1d28ad6bb93ba158a6b89eff3
2021-03-24 23:30:06 +00:00
drh
9be1339faf Comment improvements to on the distinct-agg optimization. Show a line in
the EQP output when using an ephemeral table to implement DISTINCT on an
aggregate.

FossilOrigin-Name: 037ca79e6032ca962b4f6182187bc12a7d91170d73630c8cd6fb191d2c183ee4
2021-03-24 19:44:01 +00:00
drh
6db1c9da67 Improvements to distinct aggregates such that they can sometimes avoid
using an ephermeral table to test for duplicates if the column that is
distinct is part of an index.

FossilOrigin-Name: ef4ac0ddd297bbd38351410c5a387e1628561b3f1bec9e4c2c9d76fbe29f955a
2021-03-24 17:28:11 +00:00
drh
29821b46f5 Fix a harmless compiler warning.
FossilOrigin-Name: 26b005a95e4f3e378e3bc40f57321ffbab72b6fc990d13b56b3121990d325f63
2021-03-24 17:04:32 +00:00
dan
1d14ffe63d Fix a problem with renaming a column when there is a quoted string immediately following the column name somewhere in the schema.
FossilOrigin-Name: 4719fae6262aa3563f3df6aca0170c6d847bb18ab7b0e6e7609a0e7b6f0c6b1b
2021-03-23 22:15:34 +00:00
drh
5191ae06ab Add an ALWAYS() on a branch that is always taken.
FossilOrigin-Name: 0646d2260c523d368e3f6bc3d110a9011d35ce83bd6751ad412d8fd9a253cb7a
2021-03-23 21:02:24 +00:00
drh
0227d9304d Test result adjustments in test/misc7.test due to the EQP format change.
FossilOrigin-Name: d3ade8c7fe58e05af9d44a79478776b050a680c1338188f2d4b222b937e682ea
2021-03-23 19:39:27 +00:00