Commit Graph

37 Commits

Author SHA1 Message Date
drh
b3623e0af7 Fix the whereKeyStats() routine (part of STAT4 processing only) so that it
is able to cope with row-value comparisons against the primary key index
of a WITHOUT ROWID table.
[forum:/forumpost/3607259d3c|Forum post 3607259d3c].

FossilOrigin-Name: 0620e419a927a3da6ebe921aaa3471686f0fdc2e485f4c2d5c88f32092228724
2022-07-15 12:16:11 +00:00
drh
486191603f New test cases for row values and RIGHT JOIN.
FossilOrigin-Name: 5f0582b90fab9111e4a645c692549c35480e62635c596f8c7fa3466bd22f7235
2022-06-01 20:08:22 +00:00
drh
1324b2830e Fix a typo in a comment in a test case. No changes to code.
FossilOrigin-Name: 570efa45dd4c6848dcbd550f78fcaa00b6d84dcffe0a2d12e65ea8ee4468c0e8
2022-06-01 13:01:57 +00:00
drh
02e3e04134 For the MULTI-INDEX-OR optimization, when pushing down WHERE clause terms from
the main query into the various OR-term subqueries, do not push down slices
of a vector comparison, since the right-hand operand of the comparison might
have only been initialized in a different OR branch that was not taken.
dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1.

FossilOrigin-Name: 9f67ad00cd38b7c5ec6d14b379e1a611777bbdf6901d843a80712ba7d94d6d33
2022-02-04 13:05:29 +00:00
drh
e482fde6ee When computing a vector to be used as a key for an index lookup, do not
check for NULL values and abort until after all key values have been
computed, in case one of the later key values involves some initialization
that is needed by a LEFT JOIN.  Fix for the problem identified by
[forum:/forumpost/ab95010d410a0a55|Forum post ab95010d410a0a55].

FossilOrigin-Name: 4db5217a28ce767fa14ddfe51cf3ca25eceb72079d46a2fc00f7d6b8ae9abe0b
2022-01-21 16:41:11 +00:00
dan
19e4eefbca Fix a case where combining row-value UPDATE FROM syntax with window functions over aggregates can cause an error.
FossilOrigin-Name: 4a587c3492faa99490fd67ca1de9fceafcdc12d220f42817791923be258b73f1
2021-06-03 18:56:42 +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
drh
78197e0f8b Fix an assert() that might be off-by-one in the case of a prior
errors in the parse.

FossilOrigin-Name: 06b15b17be38c804dd2641d8616a2a7bd396d2eb9901a0fbf94edd8bd508cf9c
2021-02-03 12:35:51 +00:00
drh
70d6b8327a Back out the NEVER() from check-in [40d10e7aad5b8992] because it is reachable
after all. Ticket [892575cdba4e1e36]

FossilOrigin-Name: f481636f1a0333c6e98906e5d4433bf1d046380bc29c760e8e7e2c2b3530b956
2019-12-30 23:50:19 +00:00
drh
6c68d7592f Fix a false-postive in the sqlite3ExprImpliesNonNullRow() decision routine,
that resulted in an incorrect LEFT JOIN strength reduction when the
WHERE clause contained a row-value comparison.
Ticket [02aa2bd02f97d0f2]

FossilOrigin-Name: ea20068e6d97c9349ebcc7d0a01e99ebf08c6f44363f71a0218a1abea209adc5
2019-11-04 02:05:52 +00:00
drh
269d322de2 When a vector comparison appears in the WHERE clause and the constraint side
has a COLLATE clause on the first term of the vector, be sure to honor that
COLLATE clause.  Ticket [135c9da7513e5a97].

FossilOrigin-Name: 978b2d20cf95d0b7143e3104ce1e9d5c85002867b554dc6b21deb528b730bbc7
2019-10-23 18:09:39 +00:00
drh
db36e255d5 Disqualify row-value comparisons for use by an index if the right-hand side
has an affinity that does not match the index.
Fix for ticket [6ef984af8972c2eb]

FossilOrigin-Name: 5c118617cf08e17a6edfdfba86e3fc49132a780990b68b52724c2aaeac85f506
2019-10-22 19:51:29 +00:00
drh
98c94e60d0 Previous check-in to fix [b47e3627ecaadbde] was incomplete. This check-in
completes the fix and adds a test cases.

FossilOrigin-Name: c7da1c01f1f239e68c2173ac5748b8c5798271e43bdcee68f51f97cd0ca92bd5
2019-10-22 11:29:22 +00:00
drh
cb99c57a66 Allow the RHS of a row-value IN operator to use a compound query with
an ORDER BY clause.

FossilOrigin-Name: eaf15d9bae6773058341d6219241f44ce728ad1cb9cf649f2efd4dddd81ec461
2019-08-09 20:26:01 +00:00
drh
c6e519f335 Fix a assert() in the query planner that can arise when doing row-value
operations on a PRIMARY KEY that contains duplicate columns.
Ticket [1a84668dcfdebaf12415d].

FossilOrigin-Name: dcb8c73594ea6b12bad98dc883a585d3e6b925c2ead267dc40332b3d266db5e8
2018-11-03 13:11:24 +00:00
drh
b3f0276b9e Fix test cases so that they work with the new EXPLAIN QUERY PLAN output
format.  Only some of the cases have been fixed.  This is an incremental
check-in.

FossilOrigin-Name: 5f0e803e33aa557865d5fc830d9202d628de9a94c9757058ca48f1a560702cd3
2018-05-02 18:00:17 +00:00
drh
e28eb64d09 Fix a memory leak in the processing of nested row values. This problem has
existed every since row values support was added (version 3.15.0, 2016-10-14)
but was only just now detected by OSSFuzz.

FossilOrigin-Name: 2df6bbf1b8ca881c8a465d6624de66fde4c5975ccae6b2f2dda392b137f577de
2018-02-18 17:50:03 +00:00
drh
a9abfb1e6c Improved test cases for the [f484b65f3d6230593c34f] bug.
FossilOrigin-Name: 1f300514e6cdd32c755dc1b05dfa125b10eda2eb55a1024b66f66dbf5cf96289
2018-02-13 19:13:05 +00:00
drh
4d1c6845ff Fix an incorrect table lookup used to find the appropriate search operator
for a WHERE clause on a row-value inequality.  The incorrect table lookup
was causing an incorrect answer for the less-than operator.
Fix for ticket [f484b65f3d6230593c34f11]

FossilOrigin-Name: f3112e67cdb27c1aec8d2cee3cb91ade061d093e13505894698e26336898b336
2018-02-13 18:48:08 +00:00
dan
a916b57013 Fix a bug causing spurious "sub-select returns N columns expected 1" errors
in join queries with a term like "(a, b) IN (SELECT ...)" in the WHERE clause.

FossilOrigin-Name: 14dfd96f9bca2df5033b2d894bf63cc8bf450a45ca11df5e3bbb814fdf96b656
2018-01-23 16:38:57 +00:00
dan
f299edb0b0 Add test cases for the fix in [f12ed3ce]. No problems discovered.
FossilOrigin-Name: 548532fdcf84d565c17aed79a6b595e8b62a3ab4
2017-01-03 08:11:24 +00:00
drh
90a7eae84c Test cases for the row-value UPDATE TRIGGER fix.
FossilOrigin-Name: b9b964373c89a491649f366ad7d70ae4d69b891d
2017-01-02 23:43:03 +00:00
drh
245ce62ea2 Detect row-value comparison size mismatches even when the size of one
operand is obscured by an unexpanded subquery.

FossilOrigin-Name: 2c4d167ccd4be591487f404de9ee629fd484c8bf
2017-01-01 12:44:07 +00:00
drh
e0a04a36a6 All temp.sqlite_master to be used as an alias for sqlite_temp_master.
FossilOrigin-Name: 8d646905b830d5bb29092e103ac5cb499b3c7e5a
2016-12-16 01:00:21 +00:00
dan
44c5604ced Prevent the flattening or where-term push-down optimizations from obscuring
misuses of SQL row values that can lead to crashes or assert() failures.

FossilOrigin-Name: 433d16ff3adfede3be53d5b0e0512f37e225591b
2016-12-07 15:38:37 +00:00
dan
4b72524072 Code constant vector components outside of any loops in CASE and BETWEEN
expressions. Fix for [1a684656].

FossilOrigin-Name: c08aff13ead3e6a8b92c0f031b08f7e556922e70
2016-11-23 19:31:18 +00:00
dan
3bafdede8a Handle some obscure "row value misused" cases that could cause segfaults or
assertion failures.

FossilOrigin-Name: fba5fddb1c40af75634b01c1f06d2610df697e01
2016-11-11 15:49:01 +00:00
drh
c52496f57f Make sure left-join markings are transferred to the virtual scalar
subexpressions when decomposing a vector comparison in the ON clause of
a LEFT JOIN.
Fix for ticket [fef4bb4bd9185ec8f].

FossilOrigin-Name: 619f5cc71774a37648e185c8502d7af14eb09b7f
2016-10-27 01:02:20 +00:00
drh
b29e60c448 Catch vector size mismatch problems during name resolution to avoid later
problems.

FossilOrigin-Name: 56562a0346170cf7b72445976864b058437a8ac3
2016-09-05 12:02:34 +00:00
dan
7887d7f24d Fix a buffer overrun in the code for handling IN(...) operators when the LHS of the operator contains indexed columns or expressions.
FossilOrigin-Name: f41a0391b732a8c4ad188163f34a0f4a22237bb5
2016-08-24 12:22:17 +00:00
drh
e835bc1285 Simplify the row value misuse error message.
FossilOrigin-Name: 838c50a5bf46fd0340839d577fa28ba02b4f2034
2016-08-23 19:02:55 +00:00
dan
553168c706 Fix a problem with vector range constraints involving the rowid column. And other issues.
FossilOrigin-Name: 3ef75d45ebcd8ede91596d69e55fe7d685008a60
2016-08-01 20:14:31 +00:00
dan
870a0705fe Fix a problem with IN(...) constraints where the LHS is a sub-select that is an aggregate query.
FossilOrigin-Name: 1f4dba87da4a44ad26223ad965731164c0d9bad9
2016-08-01 16:37:43 +00:00
dan
5c288b929a Fix problems with vector == comparisons and NULL values.
FossilOrigin-Name: 059d0d05354e6efab7892c97b339ffa0b5303587
2016-07-30 21:02:33 +00:00
dan
19ff12dd76 Fix some issues with vector range constraints and the column cache. Also vector range constraints and rowid columns.
FossilOrigin-Name: 42607366bfc2dceb1013797a973b3b8df75dcb4d
2016-07-29 20:58:19 +00:00
dan
71c57db099 Add some support for using row value constructors in certain parts of SQL expressions. There are many bugs on this branch.
FossilOrigin-Name: b2204215b231202aef7a218411cc2ddaecf28f35
2016-07-09 20:23:55 +00:00