haskell - HDBC-postgreSQL bytea fields get returned as SqlByteString hex strings -
when select bytea
fields filled binary data in postgres database using hdbc-postgresql driver (version 2.3.2.3), come out as:
sqlbytestring "\x<hex representation of binary data>"
that is, returns bytestring
contains string containing \x
followed hex representation of binary data. inconvenient, dreadfully inefficient , makes no sense me.
is there reason why doesn't return sqlbytestring
containing byte string actual binary data inside it? there missing, or how configure driver that?
thanks
this longtime known issue library. see this bug example.
the broader problem getting raw bytes requires fair amount of cleverness postgres api doesn't make obvious. have call entire query binary rather text output (which arguably better anyway, require rewrite of portion of binding layer).
you can see where pqexecparams called , note called last parameter of 0, postgres docs means comes in text. , postgres means funny hex representation see.
if argument swapped 1, things done more efficiently (including getting raw binary bytea
fields) statement.hsc
have pervasively rewritten deserialize binary values.
this 1 of things irritating lots of people, nobody has yet been sufficiently motivated go rewrite , debug whole thing. but, of course, should! :-)
Comments
Post a Comment