This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-15
Channels
- # ai (1)
- # announcements (1)
- # aws (4)
- # babashka (9)
- # biff (1)
- # calva (1)
- # clerk (15)
- # clj-kondo (24)
- # clojure (23)
- # clojure-austin (7)
- # clojure-europe (19)
- # clojure-nl (2)
- # clojure-norway (33)
- # clojurescript (43)
- # conjure (4)
- # data-science (2)
- # datahike (5)
- # datomic (14)
- # defnpodcast (27)
- # domino-clj (1)
- # events (1)
- # honeysql (13)
- # hyperfiddle (44)
- # introduce-yourself (1)
- # java (4)
- # jobs (1)
- # jobs-discuss (11)
- # lsp (3)
- # malli (14)
- # missionary (5)
- # off-topic (44)
- # pedestal (2)
- # podcasts-discuss (1)
- # releases (8)
- # remote-jobs (2)
- # shadow-cljs (3)
How could I generate this syntax? (Postgres array access subscript):
select eb.post_ids[1] from eb;
I'm interested mainly in tacking the [1]
array subscript to any column in a select...
I'm surprised I can't find anything on it, anywhere. Also surprised that I have never had a need for it myself. I'd probably add a custom function/operator and make a PR for HoneySQL.
I'd be happy to add something like [:ix :col index-expr]
=> col[index-expr]
but the name needs some consideration + tests + docs.
At least in my case, the I ended up doing
[:raw "(array_agg(timestamp))[1] as timestamp"]
Good point about needing (
.. )
if you have a col-expr. Does PG allow (col)[1]
or are parens only allowed for an expression there? (I never use PG so I've no idea how fussy it is)