LucaCappelletti94 opened a new pull request, #2775: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2775
`SELECT interval '1' week` parses as a one-week interval under `PostgreSqlDialect`, but PostgreSQL (VERY COUNTERINTUITIVELY) returns one second in a column named `week`. Its grammar (`opt_interval` in [gram.y](https://github.com/postgres/postgres/blob/master/src/backend/parser/gram.y)) takes only `YEAR`, `MONTH`, `DAY`, `HOUR`, `MINUTE` and `SECOND` and their `TO` ranges as an interval qualifier, so any other word after the value is a column alias. The same holds for `decade`, `quarter`, `epoch` and plural spellings such as `days`. The words that can start a qualifier move from `Parser::next_token_is_temporal_unit` into a new `Dialect::is_interval_qualifier`, with the existing list as the default and PostgreSQL's six fields as its override. Other dialects parse as before. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
