drh
33b2cb9aec
Fix the query flattener to deal with a RIGHT JOIN corner case described
...
by [forum:/forumpost/323f86cc30|forum post 323f86cc30].
FossilOrigin-Name: 3f45007d544e5f787d5837b4d9f484ba473d69cdba83c229228e9c2f6b972b75
2022-06-07 13:09:58 +00:00
dan
410fac35d7
Fix a problem with flattening and window functions causing an "IS <column>" to be transformed to "IS TRUE" or "IS FALSE" when <column> is a view or sub-select expression that is the literal value "TRUE" or "FALSE".
...
FossilOrigin-Name: 2a952c7738d94e70024e06600fee8c3a49f317f2d02774468019bd7cf9488c8b
2022-06-02 16:26:21 +00:00
drh
5af8a86d62
Mark an always-true conditional as ALWAYS().
...
FossilOrigin-Name: 3492fe8a212cbe02b9016866e2499b99c3b566a4b0bc91fba267e6e1fe1b8943
2022-05-27 18:06:49 +00:00
drh
fb98dac04f
An attempt to get UPDATE FROM working when the FROM clause contains a
...
RIGHT or FULL JOIN.
FossilOrigin-Name: a124e4f96f883d8682ba7a253d33a9565ed0fc3580525225b95733bd3782a806
2022-05-25 02:32:11 +00:00
drh
40822eb262
Defer materializing a view or subquery until the materialization is actually
...
needed, so that if it is not needed, not useless work is performed.
FossilOrigin-Name: 16bf350683fd6ac906dbd02b21fb8bf1b1014ed05594cacf108645acd383ae65
2022-05-21 18:03:33 +00:00
drh
660dfbdcfb
Fix a typo in a comment.
...
FossilOrigin-Name: 34d7045b2cc8ef16fd4115499888703a376d2c3a289e7fdd117f8341ffa586c3
2022-05-21 15:54:45 +00:00
drh
b800bd63aa
Use the newer OP_BeginSubrtn opcode instead of OP_Integer to start the
...
subroutine used to matrialize a view. This does not change execution but
does make the byte code a little easier to read.
FossilOrigin-Name: cebd4fd606f967de527cff79df8e80e16d06eec257939322f16d21303868fb4d
2022-05-21 15:12:41 +00:00
drh
67a99dbee8
Improved names for flags on the Expr object: EP_FromJoin becames
...
EP_OuterON and EP_InnerJoin becomes EP_InnerON.
FossilOrigin-Name: 1ffea07ff98b894729c698b681cc7433df3bbfccd8a0529a706908602a636937
2022-05-13 14:52:04 +00:00
drh
de695eab88
Fix a harmless UBSAN warning.
...
FossilOrigin-Name: 8f9355028bc7baeeb10ee9a5e29f093adac6c2f149596dec0be827be4ce491cb
2022-05-10 15:55:10 +00:00
drh
adef15986a
Simplified "hidden" and "no-expand" handling in the *-expander.
...
FossilOrigin-Name: c6c3115f3a008cf9b0d7c5c812f17e38c8a75a904032c5f05f0bea03a7340527
2022-05-10 00:24:01 +00:00
drh
4077b006ad
Add ALWAYS() on two unreachable branches in the * expander.
...
FossilOrigin-Name: 387c852375bba62df040330944c9e979a6993f95ece3443597c5fc66e34263ca
2022-05-09 16:29:53 +00:00
drh
77874e782b
Simplify a branch in the "*" expansion logic. New test case for an
...
INSTEAD OF trigger on a RIGHT and FULL outer join.
FossilOrigin-Name: d2717348f43b571c7bb58498e0c723331abf85de174189e66aca2c438ca26d5f
2022-05-09 12:59:16 +00:00
drh
00e5d3d59e
Fix a typo in a comment.
...
FossilOrigin-Name: c19c3c48698bf2543d775411c62d01e629791e2f3c5317970fdbb830eacafac6
2022-05-03 16:18:25 +00:00
drh
d88fd53989
Organize the various flag bits of the ExprList_item object into a substructure
...
so that the whole lot can be copied all at once. Faster and smaller code.
FossilOrigin-Name: 5341d4bbe9a943f9cdbbdea829e18f108e98972ebb706396c50fc62fcc6a6328
2022-05-02 20:49:30 +00:00
drh
63879a2c99
Improved comments.
...
FossilOrigin-Name: 158b80bed61ade793ccfd979f26a5231fabc8c14697ca0141bba61bc13e3b2ba
2022-05-02 20:04:34 +00:00
drh
72d620bdb1
Name resolution and "*" wildcard expansion for parenthesized FROM clauses
...
seems to work the same as PG. The code is chaos, however, and needs some
cleanup.
FossilOrigin-Name: 6f9c0b07aadc5189c65c3ee4e6938aac10fc0d98f1cb06980f5e5d7b0308f237
2022-05-02 19:59:03 +00:00
drh
4bea8c6b56
Tweaks to the name resolution on parenthesized joins. A small number of
...
tests fail now due to extra columns appearing in the expansion of "*".
FossilOrigin-Name: c86804917e3fffcf0c19bbf11875667f7968275210fc768e650826bd9c87a5d2
2022-04-28 17:35:58 +00:00
drh
09121b0523
Merge trunk enhancements into the right-join branch.
...
FossilOrigin-Name: 3fd9706bba4a71cb5c7ce1341c3be0a7727941445820a073e7b2f0f32512e8ef
2022-04-28 12:52:49 +00:00
drh
0e464b5f51
Do not allow the push-down optimization on the right table of a RIGHT JOIN.
...
FossilOrigin-Name: 05917bfa02a7b6678c147d10fb53f55532ab15fd5d82d925ae921ae3759f0115
2022-04-25 20:47:58 +00:00
drh
5eb6e09795
The pushDownWhereTerms() routine should be using
...
sqlite3ExprIsTableConstraint(), not sqlite3ExprIsTableConstant(). This fixes
many problems, but still an error persists in join7.test.
FossilOrigin-Name: 10bf0e613809f71cc1a47ad40b517e2a66671212a6464e179c9d377e8b70d499
2022-04-25 20:38:42 +00:00
drh
a9cdb90421
Fix a problem with automatic indexes introduced by
...
check-in [664b461bb5063d980] and reported by
[forum:/forumpost/0d3200f4f3bcd3a3|forum post 0d3200f4f3bcd3a3].
FossilOrigin-Name: 7ca3456c00998a429418ff29cf251b381586b330b88344c94a40c5df0b71da85
2022-04-25 19:40:33 +00:00
drh
95fe38f2fc
Add a new optimizer disabling bit to disable just the UNION ALL branch of the
...
query flattener.
FossilOrigin-Name: c0f9ebab5455d8541a562122d3270b95ce571c3fd870b0048dda2b036c2b66c0
2022-04-25 14:59:59 +00:00
drh
d63c07e6c5
Fix an operator typo - This indicates that the branch needs further
...
investigation and verification.
FossilOrigin-Name: f6ab67965b718b0c6d7faf769c7e47384cfd2ddbb03df518e0c5d367f8583387
2022-04-23 14:30:22 +00:00
drh
ab843a51d3
Fix minor problems with the new join table name resolution logic.
...
FossilOrigin-Name: 3a6b0db4519072dbd41b1c105bf1a0c6b4dd90380e94a5662645d8d41483c707
2022-04-23 07:29:34 +00:00
drh
45e41b7371
Add the ability to access the USING columns of the right or left tables
...
of an OUTER JOIN even if the OUTER JOIN is in parentheses. Prototype code
only.
FossilOrigin-Name: c3a427575fe71de3061495059e253c72c7213e2925ee2873e4f59fc73bfae103
2022-04-22 23:18:21 +00:00
drh
d6bb6000ef
Make use of the "%!S" format when running ExplainSubquery.
...
FossilOrigin-Name: 9425d79cb407dedc259655625369e023d22a04ef7db606ea3eefe7e4d662be1a
2022-04-22 18:07:38 +00:00
drh
da653b897d
Improve EXPLAIN QUERY PLAN output and comments on bytecode listings by
...
distinguishing between "subquery" and "join" and using consistent names
across EQP and bytecode.
FossilOrigin-Name: a2d3ee92420ec564e31eb0005367cf7ff3d00bfaed5a98ffdbe17c91c95d9d97
2022-04-22 17:36:10 +00:00
drh
67f70bea06
Honor the MATERIALIZED keyword on a common table expression by not flattening
...
the CTE into an outer query.
FossilOrigin-Name: 8d631a6b9eb06b54b10eda595a4c588ca38f909b4afa653b24d1f720b55d72f7
2022-04-22 16:15:48 +00:00
drh
9c2d7aa7d0
Minor simplification to the result-set wildcard expander for SF_NestedFrom.
...
FossilOrigin-Name: d942530a6550a0cbe31790e462b0f0d57b9b4a896161878b7d45d11cbc1cb7a3
2022-04-22 12:46:46 +00:00
drh
18f8600fe6
Avoid materializing columns of SF_NestedFrom subqueries that are never used.
...
Other code improvements manually imported from the right-join-paren branch.
FossilOrigin-Name: cd8272fc2a34d1b245fd95208b9b601266ee7d2ff0f5ce52d03752f2c4e852a2
2022-04-21 13:11:26 +00:00
drh
22b410d894
Small correction to the new bUsed logic of sqlite3ProcessJoin().
...
FossilOrigin-Name: ba04142e09bb1ccc86824760a2e11df47e070285a2d09c2f61b75255886597cd
2022-04-20 18:12:42 +00:00
drh
bc656e220f
Comment fixes and improvements in sqlite3ProcessJoin().
...
FossilOrigin-Name: 1118655f4d58da1273e83954c80d8bc17fa3bde7a39e81cb9947d59894d5ab93
2022-04-20 16:26:22 +00:00
drh
815b782e99
Improved tracking of nested SELECT objects used to implement
...
parenthensized FROM terms.
FossilOrigin-Name: 0da2232624571f4020c05d775ea518514d748fba8dacd4caba2e2e6ed1ae399f
2022-04-20 15:07:39 +00:00
drh
befbb40f44
Merge the ALTER TABLE fix from trunk.
...
FossilOrigin-Name: d5ceaef3fca8cb4791ead9cbfe00d0eafa1bdc2b0522c3599c68b40fe6a7efe2
2022-04-19 23:00:32 +00:00
dan
cbde37d8e4
Fix a problem in ALTER TABLE with handling "table.*" expressions within SELECT statements in triggers.
...
FossilOrigin-Name: 24755fd0657252e49793bb1fe906973a2dd84a1bde03bea9a762de36cc96c2d2
2022-04-19 20:47:18 +00:00
drh
3117b7b081
Fix a NULL-pointer dereference that can occur on an aggregate query that
...
uses FULL JOIN. dbsqlfuzz 496a35dd4eefcd7935aaaeb0c69056bf49785d28.
FossilOrigin-Name: 63b8f8aec2a9ac3fbbd02715aa308eaf43c9ffde9d7c6db026d46edc575e7bdd
2022-04-19 18:23:01 +00:00
drh
e32d6a0bbf
Mark an unreachable "just-in-case" branch as unreachable.
...
FossilOrigin-Name: b966d52437f08a6759a83a45cafb0d706a8933a8e55dee38ae78166d1a5b3ba4
2022-04-19 15:56:03 +00:00
drh
1c2bf41a12
Fix the query flattener so that it does not flatten a RIGHT or FULL JOIN into
...
any position of the outer query other than the first.
FossilOrigin-Name: 837322aa95b1c46201b7dd0c2e6c7b9915b4276d997949f1ecf961fb7f3514cf
2022-04-18 23:20:02 +00:00
drh
abf86bd313
Leave sqlite3ProcessJoin() early if an OOM is encountered in the NATURAL
...
to USING converter. This avoids NULL pointer dereferences further along in
the code.
FossilOrigin-Name: 0ccb224e13ad44c7e1a3aa186821a929faabc0075fe15799476c00d9a92e9d91
2022-04-18 09:59:33 +00:00
drh
d0453f7ec5
When converting a NATURAL JOIN into a JOIN USING, make sure to insert the
...
name correctly into the IdList even if it is a wierd quoted name.
FossilOrigin-Name: e62156b696f2496e2697cb3b46f136551b58644e2a5824aa3d759596694b2f4b
2022-04-18 00:04:15 +00:00
drh
fe14699765
Further improvements to USING() processing for RIGHT and FULL JOINs. All
...
currently known issues are now resolved. Performace is improved.
FossilOrigin-Name: 9fd3f22e2228dfba127f6ffe549109f3a4e910fa124adcc9c5483931bd6d5cd7
2022-04-17 18:46:17 +00:00
drh
052953a4e6
Fix the USING to ON translation so that it works correctly for a sequence
...
of two or more joins where one of the joins to the right-hand side of the
list is a RIGHT or FULL JOIN.
FossilOrigin-Name: 9ffc2b231956cde1bc90519aa174b0e2dc30ef671ed745f4f3ffa9fbb7ffab4b
2022-04-16 22:57:41 +00:00
drh
cebc8009ed
Additional SELECT trace logic: Show the tree after result-set wildcard
...
expansion but before name resolution.
FossilOrigin-Name: a7babf75418adffa27dec7a9d382a60e1b9364fb51d72b0a10e2769b308b3c54
2022-04-16 18:33:22 +00:00
drh
bdbda1eb1f
RIGHT JOIN USING now appears to work the same as PG-14. Legacy tests pass.
...
FossilOrigin-Name: 5bfb862419541de955dae35fc91f6e9fc70e2744bb786d49fa26bede80b9091d
2022-04-16 12:40:52 +00:00
drh
4ce7bf9156
When expanding "*" in the result set of a SELECT, do not attach a table name
...
to columns that are in subsequent USING clauses.
FossilOrigin-Name: 91530990e018580ec5322ace6f0c369a32a3529a0bfb4defb25ca20223a2a80f
2022-04-15 18:30:48 +00:00
drh
22c4bc8991
The sqlite3ProcessJoin() routine converts a NATURAL JOIN into a JOIN USING so
...
that henceforth the NATURAL keyword can be ignored.
FossilOrigin-Name: 8378e1e0d289627fb294ccd3f5865ef49df3a42b8a5aa211e21be1b42d9da753
2022-04-15 17:08:40 +00:00
drh
358424aeff
Add the "3" in the name of the sqlite3ProcessJoin() function.
...
FossilOrigin-Name: b925f72b6f679c61b0d6be16fabe64dc7605550b7bd86f35c586dcecd8217673
2022-04-15 15:15:01 +00:00
drh
f7309bce10
Ensure that the JT_LTORJ bit in the SrcItem.fg.jointype is preserved during
...
query flattening.
FossilOrigin-Name: 61259050152321bc57dbdfdc3edcabb4f18c021b1ee0491c1e04ae24c7a59d89
2022-04-12 20:20:54 +00:00
drh
0879d5f9e0
For the bad join type error message "unknown or unsupported join type"
...
remove the "or unsupported" clause, because we now support all valid join
types.
FossilOrigin-Name: ab0a0562dd3594cf50ee56f6b3a5847fa5dcadf69146d560e3e7a95651b8f405
2022-04-12 18:40:14 +00:00
drh
c133bab72a
The query flattener must add TK_IF_NULL_ROW opcodes on substituted values
...
that land on the left operand of a RIGHT JOIN, just as it already does for
the right operand of a LEFT JOIN.
FossilOrigin-Name: 8e02cdf5b1128f5e5b82d93903063415ec312694e5ccdd19e99fa35433f1b68a
2022-04-11 20:15:52 +00:00