Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

test to show joins aren't associative #66

Closed
wants to merge 1 commit into from

2 participants

@doooks

No description provided.

@doooks

hi guys can you give us any indication of how you are prioritising this bug? We worked around it the first time we saw it by re-ordering some joins, but this time we can't work around it and its breaking our app.
If you aren't intending to fix it we can attempt a patch but let us know please.
Cheers
dan

@LauJensen
Owner

Merged and fixed.

THANKS

@LauJensen LauJensen closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 test/clojureql/test/core.clj
View
7 test/clojureql/test/core.clj
@@ -252,6 +252,13 @@
"ON (countries.id = spots_subselect.country_id) "
"WHERE (regions_subselect.country_id = spots_subselect.country_id)")))
+ (testing "joins are associative"
+ (let [ta (join (table :t1) (table :t2) :id)
+ tb (join (table :t3) ta :id)] ;; swapping argument order of "ta" and "(table :t3)" works
+ (are [x y] (= (-> x (compile nil) interpolate-sql) y)
+ tb
+ "SELECT t1.*,t2.*,t3.* FROM t1 JOIN t2 USING(id) JOIN t3 USING(id)")))
+
(testing "update-in!"
(expect [update-or-insert-vals (has-args [:users ["(id = ?)" 1] {:name "Bob"}])
find-connection (returns true)]
Something went wrong with that request. Please try again.