sql

All things SQL and JDBC...
2020-12-28T09:50:19.023900Z

Hi. I’m looking into using next-jdbc and I’m trying to get it working with the Postgres JSON and array datatypes. I’ve added the suggested ReadableColumn extensions for https://github.com/seancorfield/next-jdbc/blob/c76d2241a8d6f26bc86975a91cb7c6615f1118a6/doc/tips-and-tricks.md#working-with-arrays and https://github.com/seancorfield/next-jdbc/blob/c76d2241a8d6f26bc86975a91cb7c6615f1118a6/doc/tips-and-tricks.md#working-with-json-and-jsonb (code exactly as shown in those links) and they seem to be working for the simple case:

(jdbc/execute-one! ds ["select ARRAY[1,2];"]) ;; => {:array [1 2]}
(jdbc/execute-one! ds ["select json_build_object('id', 1, 'name', 'test');"]) ;; =>  {:json-build-object {:name "test", :id 1}}
However, when I have some json within an array I still get the PGobject rather then the json:
(jdbc/execute-one! ds ["select ARRAY[json_build_object('id', 1, 'name', 'test')];"])
;; => {:array [#object[org.postgresql.util.PGobject 0x2ec40fa4 "{\"id\" : 1, \"name\" : \"test\"}"]]}
Does anyone know what needs to be adjusted to make this case work too?