Skip to content

alter interval to support postgres syntax #184

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 2 commits into from
Jun 10, 2020

Conversation

maxcountryman
Copy link
Contributor

This patch updates our INTERVAL implementation such that the Postgres
and Redshfit variation of the syntax is supported: namely that leading
field is optional.

Fixes #177.

This patch updates our INTERVAL implementation such that the Postgres
and Redshfit variation of the syntax is supported: namely that leading
field is optional.

Fixes apache#177.
@maxcountryman maxcountryman force-pushed the feature/postgres-interval branch from 43ee97e to d093f7f Compare June 8, 2020 13:40
@coveralls
Copy link

Pull Request Test Coverage Report for Build 128650182

  • 25 of 27 (92.59%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 91.669%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 6 8 75.0%
Totals Coverage Status
Change from base Build 127811132: 0.05%
Covered Lines: 4060
Relevant Lines: 4429

💛 - Coveralls

Comment on lines +530 to +532
if ["YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND"]
.iter()
.any(|d| kw.keyword == *d) =>
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'm not entirely sure about this approach, but it does seem to work. I certainly would appreciate your thoughts. 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this will do for now, seems like a good place to use the maybe_parse helper from a sibling PR, as well as parse_set https://github.com/andygrove/sqlparser-rs/blob/d842f495db6936f64b2738178a431f0ebd6c4e07/src/parser.rs#L1769-L1770

@nickolay nickolay merged commit 846c52f into apache:master Jun 10, 2020
@nickolay
Copy link
Contributor

Thanks!

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.

Redshift interval literals seem to fail to parse
3 participants