diff options
Diffstat (limited to 'src/clojure_sql')
-rw-r--r-- | src/clojure_sql/dsl.clj | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/clojure_sql/dsl.clj b/src/clojure_sql/dsl.clj index 5eae2d7..c94f678 100644 --- a/src/clojure_sql/dsl.clj +++ b/src/clojure_sql/dsl.clj @@ -221,7 +221,6 @@ right (reduce (fn [query [alias table]] (rename-table query alias (keyword (gensym (name table))))) right (:tables right)) - ;;_ (assert (empty? common-tables) "Cannot join two tables with the same name") merged-tables (merge (:tables left) (:tables right)) common-fields (set/intersection (set (keys (:fields left))) (set (keys (:fields right)))) @@ -385,15 +384,17 @@ (defn union "Combine the results of two queries" [& queries] - (assert (apply union-compatible? queries) "Unioned queries must expose the same fields.") + {:pre [(apply union-compatible? queries)]} (assoc (q/->Query) :set-operation :union - :queries queries)) + :queries queries + :fields (zipmap (keys (:fields (first queries))) (repeat nil)))) (defn intersection "Take the common rows in two queries" [& queries] - (assert (apply union-compatible? queries) "Unioned queries must expose the same fields.") + {:pre [(apply union-compatible? queries)]} (assoc (q/->Query) :set-operation :intersect - :queries queries)) + :queries queries + :fields (zipmap (keys (:fields (first queries))) (repeat nil)))) |