hugsql

bostonaholic 2017-04-27T20:13:07.315891Z

how do I read a value from postgresql database that is of type jsonb?

bostonaholic 2017-04-27T20:15:07.345970Z

I was hoping I could cheshire.core/parse-string it, but that isn’t working

bostonaholic 2017-04-27T20:15:22.349885Z

throws java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast to java.lang.String

bostonaholic 2017-04-27T20:28:06.542485Z

got it working with

SELECT *, raw_data::text as raw_data_str
FROM messages
WHERE message_id = :message-id;

bostonaholic 2017-04-27T20:28:40.550948Z

then I just (-> message :raw_data_str json/parse-string)

bostonaholic 2017-04-27T20:29:04.556844Z

but please let me know if there’s a better way