diff --git a/CHANGELOG.md b/CHANGELOG.md index 2da11aaa9..9b395c5b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - #2444, Removed `db-pool-timeout` option, because this was removed upstream in hasql-pool. - @robx - #2343, PATCH requests that don't affect any rows no longer return 404 - @wolfgangwalther - - #2537, Stricter parsing of query string. Instead of silently ignoring, the parser now throws on invalid syntax like json paths for embeddings, hints for regular columns, etc. - @wolfgangwalther + - #2537, Stricter parsing of query string. Instead of silently ignoring, the parser now throws on invalid syntax like json paths for embeddings, hints for regular columns, empty casts, etc. - @wolfgangwalther ### Deprecated diff --git a/src/PostgREST/ApiRequest/QueryParams.hs b/src/PostgREST/ApiRequest/QueryParams.hs index a48268b06..82bb00eb0 100644 --- a/src/PostgREST/ApiRequest/QueryParams.hs +++ b/src/PostgREST/ApiRequest/QueryParams.hs @@ -494,13 +494,18 @@ pRelationSelect = lexeme $ try ( do -- Left (line 1, column 2): -- unexpected '!' -- expecting ")", "," or end of input +-- +-- >>> P.parse pFieldSelect "" "name::" +-- Left (line 1, column 7): +-- unexpected end of input +-- expecting letter or digit pFieldSelect :: Parser SelectItem pFieldSelect = lexeme $ try ( do alias <- optionMaybe ( try(pFieldName <* aliasSeparator) ) fld <- pField - cast' <- optionMaybe (string "::" *> many pIdentifierChar) + cast' <- optionMaybe (string "::" *> many1 pIdentifierChar) pEnd return $ SelectField fld (toS <$> cast') alias )