dan
9988db8302
Fix a bad interaction between constant propagation and transitive term handling causing patterns like "WHERE unlikely(t1.x=t1.y) AND t1.y=?" to return non-matching rows.
...
FossilOrigin-Name: 2363a14ca723c0343fbe350f6c19787a7a47c2289fd9af136c97a451b53b5226
2021-04-15 19:09:19 +00:00
dan
37d4ec86bf
Add extra test case for OOM handling in where.c.
...
FossilOrigin-Name: 7163de3dea0445bf25dba47a54c50f35bb5c7edc7bdae9630b51c1ca970ec6cf
2021-04-15 13:26:29 +00:00
dan
8505d73dc0
Fix a potential crash when using json_group_array() as a window function.
...
FossilOrigin-Name: 3c266690c753d093c2cb74138a46ed69276d85cd119d687a6858c84211e84eaf
2021-04-14 12:11:39 +00:00
dan
d487e37367
Fix a segfault that could occur if the ORDER BY clause of a compound SELECT contains a sub-select that uses one or more window functions.
...
FossilOrigin-Name: 5ba15ebb34c3af85ef6c54bbb3acb57176d629cda83774881b2a6467e138e904
2021-04-12 16:59:28 +00:00
dan
cd0b245934
Avoid an assert() failure when a compound scalar sub-select is, due to a "WHERE (sub-select) AND (... OR ...)" clause, coded twice by the code generator.
...
FossilOrigin-Name: a4e3f13329332f91a250bc18459fd4100990a1ac0516f8a0a6b21ff117db9795
2021-04-12 12:02:49 +00:00
dan
677e62aacd
Fix a problem with handling expressions like "(col IS NULL AND <expr1>) OR col == NULL" in WHERE clauses.
...
FossilOrigin-Name: 40852ca8e215e51f63652a67817361b835b6fbbff7f66af50089af91007505f1
2021-04-10 14:49:45 +00:00
dan
bfd6f1bcd5
Fix a use-after-free error that could occur when processing "SELECT aggregate(DISTINCT <expr>)..." queries.
...
FossilOrigin-Name: 0e4789860b81c31d3a6d1f9f8340042ce1d08a82bf6119c783fcab85180b1b63
2021-04-08 20:29:12 +00:00
drh
4ad9673d00
Do not allow the use of rowid for views and subqueries unless compiled
...
with -DSQLITE_ALLOW_ROWID_IN_VIEW.
FossilOrigin-Name: a2ddb89b206c13876d34c5f9e3db41cda72d6eb3fea31ffa8cc6daa1e1580e16
2021-04-07 18:17:53 +00:00
drh
6e5020e8da
Also prohibit the use of rowid from a subquery. Add the
...
SQLITE_ALLOW_ROWID_IN_VIEW compile-time option to restore legacy behavior
in case somebody actually needs it.
FossilOrigin-Name: 14b1d56ef84b0e62b7f9c4e5f7f985ca10e770c8db59f54004ad892c2a2dcbfb
2021-04-07 15:45:01 +00:00
dan
755ed41f5a
Fix a possible crash that could occur when executing a drop column operation on a corrupt database schema.
...
FossilOrigin-Name: c337849416c588142a5066db3feb1716b7a9d02536bdb73cc9da7d162c0d5494
2021-04-07 12:02:30 +00:00
drh
204b634222
Do not apply the optimization that omits DISTINCT if all result terms are
...
part of a UNIQUE index if the index is also a partial index.
Fix for the bug reported by
[forum:/forumpost/66954e9ece|forum post 66954e9ece].
FossilOrigin-Name: c2f940b02883e165172a4ca21c7095ffbef84ddc5367853dfeca93fda20d6056
2021-04-06 23:29:41 +00:00
dan
cc26301ec3
Modify the drop column code to handle WITHOUT ROWID tables for which a single column appears more than once in the primary key.
...
FossilOrigin-Name: e0d2507021c5a04016c442f954b542c0920678737ae7c710eb8ac50d6337db1c
2021-04-06 21:20:39 +00:00
drh
a6c54def42
Raise an error if a query tries to access the "rowid" of a view, as views
...
do not have rowids.
FossilOrigin-Name: 7a73c6166bb1d9f2e2de280fa4e973db152caaf6cc76b8e6a92cfe9560ddc224
2021-04-06 19:13:44 +00:00
dan
112501fec2
Update an assert statement that could fail when using "PRAGMA writable_schema = 1" to access a database with a corrupt schema.
...
FossilOrigin-Name: 55cad6f628a4313c6652b36474c3397f097ac5c2503ae94605c030a54dc40916
2021-04-06 18:02:17 +00:00
drh
4ffaffe657
New test cases added to fuzzdata8.db.
...
FossilOrigin-Name: 039ad662dd899048da04238c05b8cf384323f6e8c1087b96428ea9e20726c8c0
2021-04-06 16:55:30 +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
1408bf176e
Fix incorrect RETURNING test cases in wherelimit.test
...
FossilOrigin-Name: 20d21ff9be558c5f7773efa4efba7d36752f56c9a0caf1fd9c601aab5562dcef
2021-04-06 13:57:23 +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
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
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
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
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
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
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
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
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
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
drh
ed42b98056
When doing schema updates, try to convert (incorrect) double-quoted strings
...
into (SQL-standard) single-quoted strings.
FossilOrigin-Name: 0770470488e140fa21cb5097c26d58e21da85544af8b69faced1670bbc6d6089
2021-03-23 16:34:13 +00:00
drh
46bee2aa12
Tweaks to test/scanstatus.test to account for the new EQP format.
...
FossilOrigin-Name: 2eb28afd01f43143a9c0cd6cea68f3095f993952d54ee06b781514a7754490cd
2021-03-23 15:39:02 +00:00
drh
06c7cc7694
Changes to test/analyzeG.test to conform to the new EXPLAIN QUERY PLAN syntax.
...
FossilOrigin-Name: d8afde1bf1d41a349a161a293533a9fdf23ff23b8f1bcc323e79e806c5c526f1
2021-03-23 15:07:17 +00:00
drh
695c83ac0e
Fix a test case in bigmmap.test so that it works with the new
...
EXPLAIN QUERY PLAN output format.
FossilOrigin-Name: 9ac064fe2aee4aa1423e7c8043dfec52ecf2af3e8361ebb7d9c104cca82b4d23
2021-03-23 14:33:35 +00:00
drh
2f2091b10e
Use the canonical name, not the AS name, when showing the MATERIALIZE or
...
CO-ROUTINE lines for a CTE.
FossilOrigin-Name: 1b83e232c490fe6e9f999d30399faebfac6094bf940dc21dc459ed2c97657cb2
2021-03-20 15:46:01 +00:00
drh
8210233c7b
Revise tests cases to align with the new EXPLAIN QUERY PLAN output.
...
FossilOrigin-Name: 50fbd532602d2c316813046ed6be8be2991c281eb5f295c4c28520a0de73862c
2021-03-20 15:11:29 +00:00
drh
340fd0bc23
Dbsqlfuzz found a new way to make that branch in codeVectorCompare
...
reachable.
FossilOrigin-Name: 959272c27555e39f180d46257afe45d41da1f5df38ea269196c06741ff6a278e
2021-03-19 16:29:40 +00:00
dan
93eb906488
Fix a crash that could occur when an INSERT has more than one ON CONFLICT clause, at least one of which contains an unresolvable symbol.
...
FossilOrigin-Name: 74208386508012326a0e88ec5b4a995d1b99607720bb05785a01c2d89ea03543
2021-03-19 14:26:24 +00:00
drh
d685dd6be6
Correlated CTEs should not generate a materialization subroutine. If they
...
need to be materialized, each use case must be materialized separately.
dbsqlfuzz 01b8355086998f0a452cb31208e80b9d29ca739a.
FossilOrigin-Name: d72d865d3e8503a545603038eb26044bee42e4e8725522be678059ce6517fc8d
2021-03-19 13:53:34 +00:00
drh
f09a1794d8
Disable a test case requiring generate_series when virtual tables are not
...
available.
FossilOrigin-Name: ee86e2f4c5999a090a5d2fe8251107cf55e621a6b988f315eb82f462cc1e377d
2021-03-18 18:27:37 +00:00
dan
ca237a8b7b
Fix a problem causing spurious "<cte>: circular reference" errors to be reported when there is actually a different error in the SQL statement.
...
FossilOrigin-Name: 9981223618782bf867dfc8988d0c634a42f569228880c5c5e00aa4ae762cfff2
2021-03-18 18:25:43 +00:00
drh
8d81aac13f
Fix the OP_OpenDup opcode so that it is able to duplicate a cursor that
...
was itself opened by OP_OpenDup. Add additional verification of
ephemeral tables. Fix for ticket [bb8a9fd4a9b7fce5].
FossilOrigin-Name: bcbe5308f3a3b94f965b0f5627cb29cce2e09343b86d757e2de889f7773576e7
2021-03-18 16:47:24 +00:00