lpsmith / postgresql-simple

Mid-level client library for accessing PostgreSQL from Haskell
Other
206 stars 71 forks source link

Fix wrong parsing of arrays with text "NULL" #189

Closed lostbean closed 8 years ago

lostbean commented 8 years ago

This issue was affecting arrays that contained the text "NULL". The parser failed to recognise the correct escaping of the text "NULL" and interpreted it as a null value, throwing the following error:

λ> connectPostgreSQL "" >>= \c -> query_ c "select '{sometext, \"NULL\"}'::_text" :: IO [Only (PGArray Text)]
*** Exception: UnexpectedNull {errSQLType = "text", errSQLTableOid = Nothing, errSQLField = "_text", errHaskellType = "Text", errMessage = ""}

This PR also adds a new test case for the test suite.

lpsmith commented 8 years ago

Thanks! I'll try to get this released soon, but I'd like to take a quick swipe at #186.