Associative fix #78

wants to merge 8 commits into


None yet
3 participants

l0st3d commented Mar 8, 2011


I've had a go at fixing the problem we identified at the end of Jan, and worked around, where if you joined tables in the wrong order, then your joins disappeared from the generated sql. I've had to do this because I got to the point where we could no longer work around the problem. This identified another problem, where the joins were out of order in the generated sql, and would cause an error. So I've tried to fix that too. I'm sure that my code is horrible and will require re-writing.

I've also had a go a back porting this fix to 1.0.x on a different branch (backport-associative-fix-to-1.0.x), since the fix I did on master relied on other changes not on 1.0.1. I'll create a separate pull request for that branch.

I'd appreciate a 1.0.2 release with this functionality working soon, but until then, we'll just upload a patched version into nexus.

Many thanks,

doooks and others added some commits Jan 28, 2011

@doooks doooks Created test to show that joining is not currently associative 60a56a4
@l0st3d l0st3d Merge remote-tracking branch 'doooks/master' into associative-fix d18244d
@l0st3d l0st3d added extra test that closer matches my problem 9f5f013
@l0st3d l0st3d first attempt at fix 3df141b
@l0st3d l0st3d change order of joins so that tests pass 1954e2c
@l0st3d l0st3d change to use the same join ordering as before
Revert "change order of joins so that tests pass"

This reverts commit 1954e2c.
@l0st3d l0st3d joins should be sorted by dependency on previously joined tables
e.g. this

JOIN t3 ON (t3.c = t2.c)
JOIN t2 ON (t1.a = t2.a)

is not valid, since t3 cannot be joined to anything on t1, without t2.  Should be

JOIN t2 ON (t1.a = t2.a)
JOIN t3 ON (t3.c = t2.c)
@l0st3d l0st3d fixed sorting order 686e5c0

bendlas commented Jul 28, 2011

Merged as #80

bendlas closed this Jul 28, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment