Hello, I'm trying to use postgresql-binary to decode values retrieved using postgresql-libpq. I'm sure I'm doing something wrong but figured I'd ask for help. Here's a minimal example.
> connection <- connectdb "host=localhost port=5432 dbname=exampledb"
> Just result <- exec connection "SELECT 5::int4;"
> Just bytes <- getvalue result 0 0
> let Right (value :: Int32) = valueParser int bytes
> finish connection
> value
53
> bytes
"5"
So, it's clear that the decoder is treating "5" as its ASCII code. Maybe I need to change some setting in postgres?
I got it. exec gives back a Text formatted result. It works with execParams requesting a Binary formatted result. That's annoying that exec doesn't allow requesting a Binary formatted result.
Hello, I'm trying to use
postgresql-binary
to decode values retrieved usingpostgresql-libpq
. I'm sure I'm doing something wrong but figured I'd ask for help. Here's a minimal example.So, it's clear that the decoder is treating "5" as its ASCII code. Maybe I need to change some setting in postgres?