This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-24
Channels
- # announcements (39)
- # aws (4)
- # babashka (18)
- # beginners (32)
- # biff (10)
- # calva (22)
- # clj-kondo (11)
- # clj-on-windows (2)
- # cljs-dev (20)
- # clojure (31)
- # clojure-europe (130)
- # clojure-norway (21)
- # clojure-spec (24)
- # clojure-uk (17)
- # clojured (2)
- # clojurescript (6)
- # conjure (1)
- # core-async (5)
- # cursive (11)
- # datalevin (1)
- # datomic (9)
- # emacs (24)
- # figwheel-main (42)
- # fulcro (6)
- # gratitude (6)
- # honeysql (8)
- # juxt (16)
- # kaocha (6)
- # lsp (235)
- # malli (2)
- # nbb (7)
- # off-topic (23)
- # other-languages (24)
- # pedestal (7)
- # reitit (6)
- # sci (1)
- # shadow-cljs (21)
- # tools-build (22)
- # tools-deps (57)
- # vim (24)
One little gotcha that we’ve stumble upon is that something like
(-> (hh/delete-from :foo) (hh/where (map clauses nil-xs)))
might lead to something rather unexpected, ie instead of deleting nothing, you delete everything.
We’ve introduced a sentinel value ::all
to use when we really want all and and throw if we “accidentally” pass something that leads to hh/where
returning empty@slipset HoneySQL has a couple of modes where it highlights "unusual" conditions etc -- do you think it would be worth a check on :delete-from
to ensure it has a non-empty condition and warn/throw on that?
One could argue that this would be a problem with update as well. I know I’ve fat fingered updates without clauses in a console.
Read over what :checking
does in https://cljdoc.org/d/com.github.seancorfield/honeysql/2.2.891/doc/getting-started?q=checking#format-options and let me know if you think extending that to delete from
and update
would help (by creating an issue). Someone who genuinely wants to delete/update all rows could added a dummy true condition to suppress it (which I see a lot of people doing in SQL anyway with WHERE 1 = 1
)