Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registering new clauses before loading honeysql helpers causes assertion error #416

Closed
corasaurus-hex opened this issue Jul 28, 2022 · 0 comments · Fixed by #417
Closed

Comments

@corasaurus-hex
Copy link
Contributor

corasaurus-hex commented Jul 28, 2022

If a library or an application registers sql clauses before honeysql helpers is loaded then this assertion will fail:

https://github.com/seancorfield/honeysql/blob/v2.2.891/src/honey/sql/helpers.cljc#L1031-L1036

To test this you can start up a repl using clj -Sdeps '{:deps {com.github.seancorfield/honeysql {:mvn/version "2.2.891"}}}' and then use the following code:

(require '[honey.sql :as sql]
         '[clojure.string :as str])

(sql/register-clause!
 :on
 (fn [_ _] [])
 nil)

(require '[honey.sql.helpers :as sql.helpers])

And this will give you the following error:

Execution error (AssertionError) at honey.sql.helpers/eval1185 (helpers.cljc:1031).
Assert failed: (= (clojure.core/set (conj (clojure.core/deref (clojure.core/deref (var honey.sql/base-clause-order))) :composite :filter :lateral :over :within-group :upsert :generic-helper-variadic :generic-helper-unary)) (clojure.core/set (conj (map keyword (keys (ns-publics *ns*))) :nest :raw)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant