This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-24
Channels
- # beginners (113)
- # boot (9)
- # cider (6)
- # cljs-dev (33)
- # cljsjs (1)
- # clojure (73)
- # clojure-italy (4)
- # clojure-russia (6)
- # clojure-spec (13)
- # clojure-uk (21)
- # clojured (1)
- # clojurescript (79)
- # core-async (6)
- # core-logic (4)
- # datascript (5)
- # datomic (5)
- # duct (12)
- # events (1)
- # figwheel (9)
- # fulcro (143)
- # garden (2)
- # leiningen (1)
- # luminus (24)
- # off-topic (1)
- # parinfer (7)
- # protorepl (12)
- # re-frame (4)
- # reagent (32)
- # rum (1)
- # shadow-cljs (46)
- # spacemacs (4)
- # specter (27)
- # sql (6)
- # unrepl (3)
- # videos (1)
I'm playing with some jsonb fields in postgres, and I can execute my query against my schema fine using the postgres cli
SELECT * FROM document WHERE _type = 'debug' AND _data -> 'a' = '1';
+-------+---------+----------+
| _id | _type | _data |
|-------+---------+----------|
| 2 | debug | {"a": 1} |
+-------+---------+----------+
Yet, when executing the same (I assume?) query through jdbc, I get an error about field types.
My equivalent query-vector
["SELECT * FROM document WHERE _type = ? AND _data -> ? = ?" "test" "a" "1"]
with the error
postgres_1 | ERROR: operator does not exist: jsonb = character varying at character 57
postgres_1 | HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
postgres_1 | STATEMENT: SELECT * FROM document WHERE _type = $1 AND _data -> $2 = $3
I wrote a post on using clojure.java.jdbc with postgres and cursors! https://rymndhng.github.io/blog/2018/02/24/clojure-jdbc-resultset-cursors/