Fix wrong parsing of arrays with text "NULL".
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).
commit74b2f4a4f7f7fee5b5ede839258350f58ebcdaea
authorEdgar Gomes Araujo <talktoedgar@gmail.com>
dateFri 10 Jun 2016, 17:08 (10 years ago)
parente547fae
src/Database/PostgreSQL/Simple/FromField.hs+1−1
@@ -526,7 +526,7 @@ fromArray fieldParser typeInfo f = sequence . (parseIt <$>) <$> array delim
526526 fElem = f{ typeOid = typoid (typelem typeInfo) }
527527
528528 parseIt item =
529− fieldParser f' $ if item' == "NULL" then Nothing else Just item'
529+ fieldParser f' $ if item == Arrays.Plain "NULL" then Nothing else Just item'
530530 where
531531 item' = fmt delim item
532532 f' | Arrays.Array _ <- item = f