This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-18
Channels
- # announcements (6)
- # babashka (137)
- # beginners (115)
- # biff (4)
- # calva (24)
- # cider (1)
- # clj-kondo (15)
- # cljs-dev (18)
- # cljsrn (1)
- # clojure (43)
- # clojure-australia (1)
- # clojure-europe (11)
- # clojure-germany (3)
- # clojure-nl (3)
- # clojure-spec (40)
- # clojure-uk (6)
- # clojured (1)
- # clojurescript (24)
- # code-reviews (14)
- # core-logic (5)
- # cursive (24)
- # datahike (2)
- # datomic (3)
- # deps-new (9)
- # events (5)
- # figwheel-main (1)
- # fulcro (7)
- # helix (3)
- # honeysql (8)
- # jobs (4)
- # jobs-discuss (7)
- # lsp (59)
- # malli (9)
- # mid-cities-meetup (1)
- # nrepl (2)
- # off-topic (27)
- # portal (11)
- # re-frame (16)
- # reitit (1)
- # releases (12)
- # remote-jobs (4)
- # shadow-cljs (48)
- # spacemacs (1)
- # vim (9)
- # xtdb (14)
@seancorfield any idea about this one?
(sql/format {:select [:tzdb.source :tzdb.uri [:cast :tzdb.tag_uuids [:raw "text[]"]]]})
;;=>
["SELECT tzdb.source, tzdb.uri, cast AS tzdb.tag_uuids"]
I want something like cast(tzdb.tag_uuids as text[])
This also doesn't work for me: (sql/format {:select [:tzdb.source :tzdb.uri [:raw "tzdb.tag_uuids::text[]"]]})
Again, this works: (sql/format {:select ['foo 'bar (symbol "tzdb.tag_uuids::text[]")]})
but it's pretty ugly :)
perhaps instead of (symbol "tzdb.tag_uuids::text[]")
honeysql could support a raw
function, since [:raw ...]
doesn't seem to work everywhere.
For functions in a select you need an extra level of brackets - otherwise it's an aliased column. The docs explain that but could clearly do a better job:grin:
:select [:tzdb.source :tzdb.uri [[:raw "tzdb.tag_uuids::text[]"]]]
there's nothing that can't be fixed using an extra pair of bracketsWell, :select [[:a :b]]
means SELECT a AS b
so :select [[[:foo :a] :b]]
means SELECT FOO(a) AS b