Fix parsing of COLLATE
after parentheses in expressions
#507
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version 0.17.0 fails to parse
COLLATE
after an expression that's surrounded by parentheses, like(name) COLLATE "de_DE"
. This regression was introduced by da6a17b (#466), where an "earlyreturn
" is used to return the parsed expression when the closing parenthesis isn't followed by a period, https://github.com/sqlparser-rs/sqlparser-rs/blob/4070f3ec6e616be6e9249f7202338e0f05969237/src/parser.rs#L521-L524 but thisreturn
causes the code which parsesCOLLATE
https://github.com/sqlparser-rs/sqlparser-rs/blob/4070f3ec6e616be6e9249f7202338e0f05969237/src/parser.rs#L542-L549 to be skipped.Replacing the early
return
withif
-else
fixes this regression, as verified by a test that I've added.