diff --git a/CHANGES.md b/CHANGES.md index e4968b1..e2baf49 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +## 0.9.9 + +* Fix #253 by supporting non-sequential join expressions. + ## 0.9.8 * Fix #249 by adding `honeysql.format/*namespace-as-table?*` and `:namespace-as-table?` option to `format`. (@seancorfield) diff --git a/package.json b/package.json index f3813de..3c6590f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@honeysql/honeysql", - "version": "0.9.8", + "version": "0.9.9", "license": "EPL-1.0", "homepage": "https://github.com/jkk/honeysql", "repository": { diff --git a/project.clj b/project.clj index d7b17c3..14ee017 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject honeysql "0.9.8" +(defproject honeysql "0.9.9" :description "SQL as Clojure data structures" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} diff --git a/src/honeysql/format.cljc b/src/honeysql/format.cljc index f03801b..53eed4d 100644 --- a/src/honeysql/format.cljc +++ b/src/honeysql/format.cljc @@ -545,7 +545,7 @@ (str (upper-case (name type)) " ")) "JOIN " (to-sql table) (when pred - (if (= :using (first pred)) + (if (and (sequential? pred) (= :using (first pred))) (str " USING (" (->> pred rest (map quote-identifier) comma-join) ")") (str " ON " (format-predicate* pred)))))) diff --git a/test/honeysql/format_test.cljc b/test/honeysql/format_test.cljc index d2d4195..fa2d8eb 100644 --- a/test/honeysql/format_test.cljc +++ b/test/honeysql/format_test.cljc @@ -285,3 +285,10 @@ (java.util.Locale/setDefault original-locale)))))] (is (= (format-with-locale "en") (format-with-locale "tr")))))) + +(deftest join-on-true-253 + ;; used to work on honeysql 0.9.2; broke in 0.9.3 + (is (= ["SELECT foo FROM bar INNER JOIN table t ON TRUE"] + (format {:select [:foo] + :from [:bar] + :join [[:table :t] true]}))))