diff --git a/src/honey/sql.cljc b/src/honey/sql.cljc index ff3e90d..974e2d4 100644 --- a/src/honey/sql.cljc +++ b/src/honey/sql.cljc @@ -936,7 +936,7 @@ (defn- format-values [k xs] (let [first-xs (when (sequential? xs) (first (drop-while ident? xs)))] - (cond (contains? #{:default 'default} xs) + (cond (or (identical? :default xs) (= 'default xs)) [(str (sql-kw xs) " " (sql-kw k))] (empty? xs) [(str (sql-kw k) " ()")] diff --git a/test/honey/sql_test.cljc b/test/honey/sql_test.cljc index 987b7fb..09a4bd2 100644 --- a/test/honey/sql_test.cljc +++ b/test/honey/sql_test.cljc @@ -260,6 +260,14 @@ (is (= (format {:insert-into [:foo :bar] :values [{:foo/id 1}]}) ["INSERT INTO foo AS bar (id) VALUES (?)" 1]))) +(deftest insert-into-unhashable + (let [unhashable + (reify Object + (toString [_] "Unhashable") + (hashCode [_] (throw (ex-info "Unimplemented `hashCode`!" {}))))] + (is (= (format {:insert-into [[:lift unhashable]]}) + ["INSERT INTO ?" unhashable])))) + (deftest exists-test ;; EXISTS should never have been implemented as SQL syntax: it's an operator! #_(is (= (format {:exists {:select [:a] :from [:foo]}})