fix #509 by checking for ident? first
This commit is contained in:
parent
0115424167
commit
872cb1d006
3 changed files with 11 additions and 1 deletions
|
|
@ -1,5 +1,8 @@
|
|||
# Changes
|
||||
|
||||
* 2.4.next in progress
|
||||
* Fix [#509](https://github.com/seancorfield/honeysql/issues/509) by checking for `ident?` before checking keyword/symbol.
|
||||
|
||||
* 2.4.1078 -- 2023-10-07
|
||||
* Address [#507](https://github.com/seancorfield/honeysql/issues/507) by clarifying formatting of `:cast` in **Special Syntax**.
|
||||
* Fix [#505](https://github.com/seancorfield/honeysql/issues/505) by rewriting the helper merge function to handle both keywords and symbols properly.
|
||||
|
|
|
|||
|
|
@ -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 (and (ident? xs) (contains? #{:default 'default} xs))
|
||||
[(str (sql-kw xs) " " (sql-kw k))]
|
||||
(empty? xs)
|
||||
[(str (sql-kw k) " ()")]
|
||||
|
|
|
|||
|
|
@ -1269,6 +1269,13 @@ ORDER BY id = ? DESC
|
|||
(is (= ["SELECT FOO(bar) AT TIME ZONE 'UTC'"]
|
||||
(sut/format {:select [[[:at-time-zone [:foo :bar] :UTC]]]}))))
|
||||
|
||||
(deftest unhashable-value-509
|
||||
(let [unhashable (reify Object
|
||||
(toString [_] "unhashable")
|
||||
(hashCode [_] (throw (ex-info "Unsupported" {}))))]
|
||||
(is (= ["INSERT INTO table VALUES (?)" unhashable]
|
||||
(sut/format {:insert-into :table :values [[unhashable]]})))))
|
||||
|
||||
(comment
|
||||
;; partial workaround for #407:
|
||||
(sut/format {:select :f.* :from [[:foo [:f :for :system-time]]] :where [:= :f.id 1]})
|
||||
|
|
|
|||
Loading…
Reference in a new issue