using jsons operator with jdbi

54 views
Skip to first unread message

xj

unread,
May 13, 2021, 2:57:59 PM5/13/21
to jDBI
Hi JDBI community, 

Postgresql provides additional JSONB operators that make it easier to query JSONB column, but those operators contain a question mark, e.g. ?|  ?& ,  JDBI would complain about this with or without argument binding,  either "mixing named and positional argument is not allowed" or missing positional binding, any suggestions ? 

https://www.postgresql.org/docs/9.5/functions-json.html

Thanks

Matthew Hall

unread,
May 14, 2021, 6:25:05 PM5/14/21
to jd...@googlegroups.com
Hi xj,

This actually has to do with the Postgres JDBC driver, and is not specific to Jdbi.

Because ? has a special meaning in both Postgres and in JDBC, you have to escape any "?" meant for Postgres as "??" so it's not misinterpreted as a JDBC statement parameter.

Example: Use "??|" in your SQL statement, instead of "?|"

Hope this helps!

-Matt

--
You received this message because you are subscribed to the Google Groups "jDBI" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jdbi+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jdbi/687b9b43-f311-4bf1-a470-a4d212246334n%40googlegroups.com.

xj

unread,
May 18, 2021, 3:29:20 PM5/18/21
to jDBI
exactly what I am looking for, Thank you ! 

-xj
Reply all
Reply to author
Forward
0 new messages