Fork me on GitHub
#honeysql
<
2023-04-28
>
flowthing05:04:42

I’m a bit late with this, but it’s been a while since we updated our deps… it looks like commit https://github.com/seancorfield/honeysql/commit/3073d2852587186e1a1489c3a07b032e014881ac breaks backwards compatibility in that HoneySQL no longer allows hash sets as :values:

λ clj -Srepro -Sdeps '{:deps {com.github.seancorfield/honeysql {:git/url "" :sha "737699c11acae0863b6c9e76921a2f8c92902ca4"}}}'
Clojure 1.11.1
user=> ((requiring-resolve 'honey.sql/format) {:insert-into :foo :values #{{:bar "baz"}}})
["INSERT INTO foo (bar) VALUES (?)" "baz"]
vs.
λ clj -Srepro -Sdeps '{:deps {com.github.seancorfield/honeysql {:git/url "" :sha "3073d2852587186e1a1489c3a07b032e014881ac"}}}'
Clojure 1.11.1
user=> ((requiring-resolve 'honey.sql/format) {:insert-into :foo :values #{{:bar "baz"}}})
Execution error (ExceptionInfo) at honey.sql/format-values (sql.cljc:768).
:values expects sequences or maps
Is this an intentional change?

p-himik07:04:44

I'd argue that it's not a breaking change because hash sets were never intended to be used as :values. The docs state: > :values accepts either a sequence of hash maps representing row values or a sequence of sequences, also representing row values. And sets are not sequences. So I'd say you were relying on undefined behavior. Especially given that insertion order is meaningful in general whereas sets are unordered.

flowthing07:04:52

Makes sense, thanks. 👍