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

Support expressions in LIMIT/OFFSET #567

Merged
merged 1 commit into from Aug 11, 2022

Conversation

MazterQyou
Copy link
Contributor

LIMIT and OFFSET allow usage of complex expressions, such as 1+2, or placeholders for prepared statements, whereas sqlparser only accepts numbers. This PR adds support for any kind of expression in LIMIT and OFFSET, and adds related tests.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2829377994

  • 22 of 22 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.01%) to 89.962%

Files with Coverage Reduction New Missed Lines %
src/parser.rs 1 83.37%
Totals Coverage Status
Change from base Build 2805421159: 0.01%
Covered Lines: 9115
Relevant Lines: 10132

💛 - Coveralls

Copy link
Collaborator

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MazterQyou -- we are on a roll today!

@@ -4402,13 +4402,13 @@ impl<'a> Parser<'a> {
if self.parse_keyword(Keyword::ALL) {
Ok(None)
} else {
Ok(Some(Expr::Value(self.parse_number_value()?)))
Ok(Some(self.parse_expr()?))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alamb alamb merged commit 8176561 into sqlparser-rs:main Aug 11, 2022
@MazterQyou MazterQyou deleted the upstream-patch/limit-offset-expr branch August 11, 2022 11:13
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.

None yet

3 participants