Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jun 10, 2016
Merged

Conversation

lostbean
Copy link
Contributor

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.

lostbean added 2 commits June 10, 2016 17:06
The array parser fails to detect the proper escaping of an
textual element 'NULL' and interpret it as a null value throwing
UnexpectedNull to a perfect valid not nullable array (i.e. "SELECT '{sometext, \"NULL\"}'::_text" ~ PGArray Text).
@lpsmith lpsmith merged commit b40cd4f into lpsmith:master Jun 10, 2016
@lpsmith
Copy link
Owner

lpsmith commented Jun 10, 2016

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

lostbean added a commit to silkapp/haskell-opaleye that referenced this pull request Jun 13, 2016
This also removes a bug that was that was in both codes. See lpsmith/postgresql-simple#189
lostbean added a commit to silkapp/haskell-opaleye that referenced this pull request Jun 14, 2016
This commit avoids the code to get out of sync with postgresql-simple (i.e. lpsmith/postgresql-simple#189)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants