innerjoin=True annotation is ignored sometimes
Hi,
See the attached test script - the only difference between classes C and D is the order of the definition of the two relations, yet querying C generates a LEFT OUTER JOIN to A, while querying D generates an inner JOIN as expected. Tested with rel_0_9; 0.8.1 generates the same query in both cases.
Gabor
Comments (15)
-
repo owner -
repo owner okey dokey
#2976and ref 12ce2edc92eff647fedfd -
reporter Sorry for the ambiguity - 0.8:
SELECT ... FROM c LEFT OUTER JOIN b b_1 ON b_1.id = c.b_id JOIN a a_1 ON a_1.id = c.a_id SELECT ... FROM d JOIN a a_1 ON a_1.id = d.a_id LEFT OUTER JOIN b b_1 ON b_1.id = d.b_id
While 0.9:
SELECT ... FROM c LEFT OUTER JOIN b b_1 ON b_1.id = c.b_id LEFT OUTER JOIN a a_1 ON a_1.id = c.a_id SELECT ... FROM d JOIN a a_1 ON a_1.id = d.a_id LEFT OUTER JOIN b b_1 ON b_1.id = d.b_id
-
reporter Eh, you fix the code faster than I can write a comment :-)
-
reporter Ah ok, that's an older thread. Unfortunately, innerjoin="nested" does not seem to work:
SELECT c.id AS c_id, c.a_id AS c_a_id, c.b_id AS c_b_id, b_1.id AS b_1_id, a_1.id AS a_1_id FROM c LEFT OUTER JOIN (b b_1 JOIN a a_1 ON a_1.id = c.a_id) ON b_1.id = c.b_id
sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-00904: "C"."A_ID": invalid identifier
-
reporter SQLite does work with innerjoin="nested"
-
repo owner that issue is where the new bug here was introduced
-
repo owner but "nested" failing on Oracle, ho hum that looks wrong too, let me try that on postgresql
-
repo owner wow, the 'nested' feature generates bad SQL. I have to revisit what that feature is supposed to do exactly, separate issue from this.
-
repo owner heh. well no, slightly different but still pretty deeply the same issue... :)
-
repo owner - changed status to resolved
- Fixed a regression caused by
2976
released in 0.9.4 where the "outer join" propagation along a chain of joined eager loads would incorrectly convert an "inner join" along a sibling join path into an outer join as well, when only descendant paths should be receiving the "outer join" propagation; additionally, fixed related issue where "nested" join propagation would take place inappropriately between two sibling join paths.
this is accomplished by re-introducing the removed flag "allow_innerjoin", now inverted and named "chained_from_outerjoin". Propagating this flag allows us to know when we have encountered an outerjoin along a load path, without confusing it for state obtained from a sibling path.
→ <<cset 61384fd0e529>>
-
repo owner - Fixed a regression caused by
2976
released in 0.9.4 where the "outer join" propagation along a chain of joined eager loads would incorrectly convert an "inner join" along a sibling join path into an outer join as well, when only descendant paths should be receiving the "outer join" propagation; additionally, fixed related issue where "nested" join propagation would take place inappropriately between two sibling join paths.
this is accomplished by re-introducing the removed flag "allow_innerjoin", now inverted and named "chained_from_outerjoin". Propagating this flag allows us to know when we have encountered an outerjoin along a load path, without confusing it for state obtained from a sibling path.
→ <<cset 43663e7aac99>>
- Fixed a regression caused by
-
repo owner OK. This morning I kind of thought 0.9.7 was just about ready, but with your pace, it seems not. How much else do you have today?
-
repo owner - changed milestone to 0.9.8
-
repo owner - changed milestone to 0.9.7
- Log in to comment
OK "the same" threw me off here, these aren't "the same"....but I think I know what you're referring to