parsonsmatt · GitHub

Converting sqltype=xml values into Haskell types seem to fail:

*** Exception: Incompatible {errSQLType = "xml", errSQLTableOid = column number 1 is out of range 0..-1
Nothing, errSQLField = "column number 1 is out of range 0..-1
", errHaskellType = "Text", errMessage = "types incompatible"}

This is because Persistent tries to parse it as PersistText (using the Database.PostgreSQL.Simple.FromField instance of Text), however the oid of xml, 142, does not match the oid's of name, text, char, bpchar or varchar, resulting in an Incompatible error.

To fix this, I simply changed the type from Text to (unknown) ByteString.

Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Bumped the version number if there isn't an (unreleased) on the Changelog
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

Read the original on github.com ↗