This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-06
Channels
- # adventofcode (2)
- # announcements (5)
- # architecture (4)
- # babashka (35)
- # beginners (28)
- # calva (4)
- # cider (9)
- # clerk (30)
- # clj-kondo (11)
- # clojure (58)
- # clojure-conj (3)
- # clojure-europe (71)
- # clojure-gamedev (2)
- # clojure-nl (3)
- # clojure-uk (2)
- # clojurescript (49)
- # conjure (2)
- # cursive (2)
- # emacs (4)
- # fulcro (1)
- # honeysql (2)
- # hyperfiddle (10)
- # jobs (2)
- # jobs-discuss (18)
- # leiningen (9)
- # membrane (14)
- # missionary (1)
- # off-topic (27)
- # pedestal (1)
- # polylith (5)
- # reagent (12)
- # releases (2)
- # remote-jobs (3)
- # shadow-cljs (83)
- # sql (5)
- # squint (14)
- # tools-build (13)
Would it make sense to add support for COLLATE
to HoneySQL? So e.g. [:collate [:lower :name] :C]
results in (LOWER(name)) COLLATE "C"
.
One immediate issue though is that, according to a quick test with SQL Fiddle, different DBs require different syntax:
• PostgreSQL requires for the collation name to be quoted
• MySQL doesn't care at all
• MS SQL Server requires for it to be unquoted
I'm using PostgreSQL so currently I have this:
(sql/register-fn! :collate
(fn [f [thing collation]]
(assert (keyword? collation))
(let [result (sql/format-expr thing)]
(update result 0
(fn [sql]
(str "(" sql ") " (sql/sql-kw f) " \"" (name collation) "\""))))))
Feel free to create a GitHub issue with links to the various DB docs about it.
👍 2