Skip to content

Support HAVING/LIMIT/OFFSET/FETCH without FROM and other follow-ups #116

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

Merged
merged 7 commits into from
Jun 17, 2019

Conversation

nickolay
Copy link
Contributor

#68 made me review the keywords in RESERVED_FOR_TABLE_ALIAS and RESERVED_FOR_COLUMN_ALIAS, and I realized more of them need to be "Reserved as both a table and a column alias".

Also after TableAlias was introduced in #98 to represent alias [ (col1, col2, ...) ] as part of a TableFactor, it makes sense to re-use it in Cte.

@nickolay nickolay requested a review from benesch June 16, 2019 22:31
@coveralls
Copy link

coveralls commented Jun 16, 2019

Pull Request Test Coverage Report for Build 352

  • 43 of 45 (95.56%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 91.482%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tests/sqlparser_common.rs 36 38 94.74%
Totals Coverage Status
Change from base Build 350: -0.7%
Covered Lines: 3007
Relevant Lines: 3287

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 351

  • 43 of 45 (95.56%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at ?%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tests/sqlparser_common.rs 36 38 94.74%
Totals Coverage Status
Change from base Build 350: 0.0%
Covered Lines:
Relevant Lines: 0

💛 - Coveralls

];

/// Can't be used as a column alias, so that `SELECT <expr> alias`
/// can be parsed unambiguously without looking ahead.
pub const RESERVED_FOR_COLUMN_ALIAS: &[&str] = &[
// Reserved as both a table and a column alias:
WITH, SELECT, WHERE, GROUP, ORDER, UNION, EXCEPT, INTERSECT,
WITH, SELECT, WHERE, GROUP, ORDER, LIMIT, OFFSET, FETCH, UNION, EXCEPT, INTERSECT,
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this isn't the fault of this commit, but it's a shame that these keywords have to be duplicated between the two constants. I don't have any obvious solutions, and definitely doesn't need to be considered in this PR; just thought I'd flag it in case you happened to have any ideas.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like it either, but the solutions seemed too complex for a trivial problem...

These lists will become dialect-specific at some point, and we would be able to build the reserved lists in the dialect constructor then, I guess.

@nickolay nickolay merged commit 7857543 into apache:master Jun 17, 2019
@nickolay nickolay deleted the pr/more-followups branch June 17, 2019 23:58
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.

3 participants