From fbcd6fbdce649591d6617673c4ab573696db5c38 Mon Sep 17 00:00:00 2001 From: Donald Ball Date: Sat, 22 Aug 2015 21:24:49 -0400 Subject: [PATCH] Fix the union clause The previous version omits the UNION between the base query and the first of the union queries --- CHANGES.md | 2 ++ src/honeysql/format.clj | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4d2af95..0aab057 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,7 @@ ## 0.6.2 In development +* Fix union clause (@dball) + ## 0.6.1 * Define parameterizable protocol on nil (@dball) diff --git a/src/honeysql/format.clj b/src/honeysql/format.clj index 590bfc7..7cd5b9b 100644 --- a/src/honeysql/format.clj +++ b/src/honeysql/format.clj @@ -519,7 +519,7 @@ (str "WITH RECURSIVE " (comma-join (map cte->sql ctes)))) (defmethod format-clause :union [[_ maps] _] - (string/join " UNION " (map to-sql maps))) + (str "UNION " (string/join " UNION " (map to-sql maps)))) (defmethod format-clause :union-all [[_ maps] _] - (string/join " UNION ALL " (map to-sql maps))) + (str "UNION ALL " (string/join " UNION ALL " (map to-sql maps))))