diff --git a/src/honeysql/format.clj b/src/honeysql/format.clj index 9d09f0d..a523176 100644 --- a/src/honeysql/format.clj +++ b/src/honeysql/format.clj @@ -393,7 +393,7 @@ (defmethod format-clause :over [[_ part-clause] _] (str "OVER " (to-sql part-clause))) -(defmethod format-clause :aggregate [[_ [aggregate-fn _]] _] +(defmethod format-clause :aggregate [[_ aggregate-fn] _] (str (to-sql aggregate-fn))) (defmethod format-clause :partition-by [[_ fields] _] diff --git a/src/honeysql/helpers.clj b/src/honeysql/helpers.clj index ba4fa9d..e2fc39c 100644 --- a/src/honeysql/helpers.clj +++ b/src/honeysql/helpers.clj @@ -228,7 +228,7 @@ (update-in m [:over] (partial apply merge) (collify fields))) (defhelper aggregate [m aggregate-fn] - (assoc m :aggregate aggregate-fn)) + (assoc m :aggregate (first aggregate-fn))) (defhelper spartition-by [m fields] (assoc m :partition-by (collify fields)))