This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-14
Channels
- # adventofcode (29)
- # aws (3)
- # babashka (25)
- # beginners (13)
- # calva (4)
- # cherry (7)
- # cider (26)
- # clj-kondo (9)
- # clojure (88)
- # clojure-europe (21)
- # clojure-losangeles (3)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-uk (11)
- # clojuredesign-podcast (2)
- # clojurescript (4)
- # cursive (10)
- # datalevin (1)
- # emacs (50)
- # gratitude (1)
- # honeysql (12)
- # hyperfiddle (19)
- # jobs-discuss (28)
- # kaocha (3)
- # lsp (53)
- # malli (4)
- # meander (3)
- # off-topic (48)
- # re-frame (11)
- # releases (2)
- # ring-swagger (2)
- # shadow-cljs (50)
- # squint (26)
- # tools-build (3)
- # tools-deps (8)
- # xtdb (4)
- # yamlscript (1)
Nice, thanks @U2FRKM4TW
:cast
The array type is a bit tricky since []
are not legal in keywords but you could do:
user=> (sql/format [:cast [:any (into-array (range 4))] [:raw "integer[]"]])
["CAST(ANY(?) AS integer[])" #object["[Ljava.lang.Long;" 0x2e1ddc90 "[Ljava.lang.Long;@2e1ddc90"]]
Hmm, no, you'll want cast inside any... just a sec...
Something like this...
user=> (sql/format [:= :col [:any [:cast (into-array (range 4)) [:raw "integer[]"]]]])
["col = ANY(CAST(? AS integer[]))" #object["[Ljava.lang.Long;" 0x63d4f0a2 "[Ljava.lang.Long;@63d4f0a2"]]
Ok right, I see. Thank you. I'm new to postgres so I wasn't sure yet if CAST was the exact same, but I guess it is.
CAST( x AS y )
is the portable SQL version. x::y
is not as widely supported AFAIK.
👌 1