hugsql 2017-04-27

@bostonaholic has joined the channel

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

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

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

got it working with

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

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

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