diff --git a/project.clj b/project.clj index 9288e30..b4cbe97 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject views "1.2.0" +(defproject views "1.2.1" :description "A view to the past helps navigate the future." :url "https://github.com/diligenceengine/views" diff --git a/src/views/honeysql/util.clj b/src/views/honeysql/util.clj index def464b..fb85c31 100644 --- a/src/views/honeysql/util.clj +++ b/src/views/honeysql/util.clj @@ -8,6 +8,14 @@ (declare query-tables) +(defn- first-leaf + "Retrieves the first leaf in a collection of collections + + (first-leaf :table) -> :table + (first-leaf [[:table] [& values]]) -> :table" + [v] + (if (coll? v) (recur (first v)) v)) + (defn cte-tables [query] (mapcat #(query-tables (second %)) (:with query))) @@ -45,7 +53,7 @@ (defn insert-tables [query] - (if-let [v (:insert-into query)] [v] [])) + (some->> query :insert-into first-leaf vector)) (defn update-tables [query]