Commit Graph

29 Commits

Author SHA1 Message Date
drh
fa16f5d9d6 Enhance EXPLAIN QUERY PLAN to report the generation of constant rows using
VALUES or just a SELECT without FROM.

FossilOrigin-Name: c75eee69fa8a9b56ee58a4cc539e80cc982f43390dc3a357344d58479dd89a41
2018-05-03 01:37:13 +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
6d6e76f75f Add test cases from OSSFuzz to prevent a regression in co-routine
processing.

FossilOrigin-Name: 689743d8e3fa81e65dcb067bbf61bab09210b3b39586c865c00d9f1d6692daf2
2017-10-28 12:20:09 +00:00
drh
d8a295669c Correctly initialize the iSelectId of FROM clause terms that are a self
join of a reused materialized subquery.  Without this, the EXPLAIN QUERY PLAN
output for the query will identify the subquery using the uninitialized
(and arbitrary) iSelectId.

FossilOrigin-Name: 43c9ae371f6250fee98a7c4011726eff8ad37f5a97add4f490ac3a2dd501a0d2
2017-05-29 13:09:24 +00:00
dan
b1d6b53694 Add a missing memAboutToChange() macro to vdbe.c, the lack of which was causing an assert() to fail incorrectly. Problem found by libfuzzer.
FossilOrigin-Name: 1a24791109da607d502ac41f179fe6c1dc46c774
2015-12-14 19:42:19 +00:00
dan
fe88fbfc82 Add test cases for WITH clauses.
FossilOrigin-Name: e7e65c7559ed43e7065adc2ec1bd242bf187b7c3
2015-11-07 17:51:39 +00:00
drh
b63ce02f57 Do not allow recursive CTEs that use aggregate queries in the recursive part.
FossilOrigin-Name: 6d2999afbc25b9c238e4028f637c10eaaf0ec75e
2015-07-05 22:15:10 +00:00
drh
fccda8a162 CTEs have never add working rowids. So disallow the use of the "rowid" column
within CTEs.

FossilOrigin-Name: 0055df0445932a43e42b318ef88672dcbe312c3a
2015-05-27 13:06:55 +00:00
drh
f932f7145e Fix a problem with a stale Select.pWith pointer when a CTE is used together
with a compound query and an ORDER BY clause.

FossilOrigin-Name: 9a453f52a2b30595891604ede7d4acf61c2736a1
2015-04-12 17:35:27 +00:00
drh
8f9d0b2b25 Correctly detect the error of having a "*" wildcard on a SELECT without
a FROM clause on the left-hand side of a recursive CTE.

FossilOrigin-Name: b11d1793a06a44931edcbf12a615b49794d53a62
2015-03-21 03:18:22 +00:00
drh
d227a291b2 Use the WITH clause to help resolve names for SELECT statements on the left
of a compound query.  Proposed fix for ticket [31a19d11b97088296a].

FossilOrigin-Name: 67bfd59d9087a987f15f6148efa1ff104983e1fb
2014-02-09 18:02:09 +00:00
dan
53bed45ecb Select collation sequences for ORDER BY expressions attached to recursive CTEs in the same way as they are selected for other compound SELECT statements.
FossilOrigin-Name: 9554519c126c5e714421a82fd2e8aa9b19e11493
2014-01-24 20:37:18 +00:00
dan
05d3dc29c5 Add test cases for LIMIT and ORDER BY on recursive CTEs.
FossilOrigin-Name: 67d6c42d44cb191368ce20f553b32fcb14bfc4d7
2014-01-24 16:57:42 +00:00
drh
b090352b5a Add test cases showing the use of ORDER BY on a recursive query to control
depth-first versus breath-first search of a tree.

FossilOrigin-Name: 83b0b2916589db0184435dbd4c304387f393ed60
2014-01-24 11:16:01 +00:00
drh
aa9ce7078a Add support for LIMIT and OFFSET in a recursive query.
FossilOrigin-Name: 1945484e6b9769c1943f750f5b09860417fb190a
2014-01-22 18:07:04 +00:00
drh
fe1c6bb9c2 Get ORDER BY working for recursive queries.
FossilOrigin-Name: 37b343b01841b338954ddfa9b76d92aa50037aec
2014-01-22 17:28:35 +00:00
drh
717c09c4a9 Add a sudoku solver to the recursive query tests in with1.test.
FossilOrigin-Name: 679eff8759aa25368b977c0d26b78a9fcd9486f5
2014-01-18 18:33:44 +00:00
drh
75303a2c68 Add asserts() for a couple of unreachable conditions. Add the Mandelbrot Set
query as a test case.

FossilOrigin-Name: 2ad4583c0cc7988f0dfe78fd0a2eb0fdb92d835a
2014-01-18 15:22:53 +00:00
drh
c59731c4ae Minor simplification of error message text for a couple of errors associated
with WITH clause processing.

FossilOrigin-Name: 2031004d960526d6426d50d7b732f37b281534e2
2014-01-17 18:34:28 +00:00
drh
727a99f1e3 Tweaks to error message text.
FossilOrigin-Name: 090a77d97808b86d1e9f5c63c743a2b159a15f5d
2014-01-16 21:59:51 +00:00
dan
f2655fe8b6 Improve the error messages used to report illegal recursive cte references.
FossilOrigin-Name: 54eee9fe99290e59469bd3e1a66bb749887d37ee
2014-01-16 21:02:02 +00:00
dan
eede6a538d Fixes so that SQLITE_OMIT_CTE builds work.
FossilOrigin-Name: 3908e2ea2e7e5f466cbbbffdc27e0fe8dc9751ac
2014-01-15 19:42:23 +00:00
dan
62ba4e418d Disable automatic indices on recursive CTE references.
FossilOrigin-Name: 28aa6db8c878655255dbfb618f8d65be78e3d7e5
2014-01-15 18:21:41 +00:00
dan
f43fe6e9f6 When resolving names, consider a reference to a recursive CTE column as equivalent to a reference to the outermost name-context. This ensures that correlated sub-queries are correctly identified as such.
FossilOrigin-Name: 61be2da0ae623c1572819481508b044e9d32f294
2014-01-15 18:12:00 +00:00
dan
60e7068d75 Return an error if a CTE specifies a different number of columns than its SELECT statement returns.
FossilOrigin-Name: 9a514b50e4b01f109fbdb0aabcbfe1ddab129b44
2014-01-15 15:27:51 +00:00
dan
bfe31e7f80 Disable the flattening optimization if the sub-query is a recursive CTE.
FossilOrigin-Name: 9472f6d820a7fb233936d9b8f7a39c9d4c4d6d73
2014-01-15 14:17:31 +00:00
dan
8ce7184bc2 Add code to handle recursive CTEs.
FossilOrigin-Name: a5c2a54a07d35166911abc792008c05dea897742
2014-01-14 20:14:09 +00:00
dan
4e9119d9e8 Add code to handle non-recursive CTEs in the same way as SQL views.
FossilOrigin-Name: a26f399ba485e8127c276c5f103ec6c555e11734
2014-01-13 15:12:23 +00:00
dan
7d562dbe02 Update the parser so that sub-queries and CTEs may have WITH clauses.
FossilOrigin-Name: 704d3931b855562a619769955969d439c42ca406
2014-01-11 19:19:36 +00:00