This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-13
Channels
- # announcements (1)
- # babashka (28)
- # beginners (72)
- # biff (6)
- # calva (15)
- # clerk (14)
- # clj-otel (4)
- # cljdoc (4)
- # clojure (121)
- # clojure-europe (61)
- # clojure-nl (2)
- # clojure-norway (63)
- # clojure-uk (5)
- # datahike (35)
- # datalevin (37)
- # datomic (7)
- # emacs (2)
- # fulcro (6)
- # gratitude (1)
- # honeysql (2)
- # hyperfiddle (38)
- # malli (9)
- # matrix (24)
- # meander (4)
- # off-topic (10)
- # polylith (8)
- # reagent (2)
- # releases (1)
- # shadow-cljs (8)
- # spacemacs (4)
- # specter (1)
- # squint (5)
- # tools-deps (3)
Edit: I found the solution, maybe it will help somebody. on-conflict
supports where clause.
(h/on-conflict :name :car :brand {:where [:not= :some-column nil]})
Good morning, I am trying to write “ON Conflict with WHERE clause” which is supported by Postgresql.
Some discussion happened here so it should be possible, can somebody give me an example how to write something like this?
https://clojurians.slack.com/archives/C66EM8D5H/p1601321215069100
INSERT INTO table (name, formula, car, brand)
VALUES ('abcd, '100, '8afc4b89-9738-4019-adab-d612dda6020c', 'renault')
ON CONFLICT (name, car, brand) WHERE some_column IS NULL
DO UPDATE SET name = EXCLUDED.name, formula = EXCLUDED.formula, car = EXCLUDED.car, brand = EXCLUDED.brand
https://cljdoc.org/d/com.github.seancorfield/honeysql/2.5.1103/doc/getting-started/postgresql-support shows an example of this FYI
👍 1