Skip to content

Support Snowflake-specific EXTRACT syntax #1373

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

Closed
seve-martinez opened this issue Aug 10, 2024 · 0 comments · Fixed by #1374
Closed

Support Snowflake-specific EXTRACT syntax #1373

seve-martinez opened this issue Aug 10, 2024 · 0 comments · Fixed by #1374

Comments

@seve-martinez
Copy link
Contributor

seve-martinez commented Aug 10, 2024

Per the Snowflake docs, EXTRACT functions can be written one of two ways:

SELECT
  EXTRACT(hour from foo)
FROM bar
SELECT 
  EXTRACT('hour', foo) -- or unquoted hour
FROM bar

This will result in a parse error:

ParseError(ParserError("Expected: date/time field, found: 'hour' at Line: 14, Column: 13"))

The parse_extract_expr() method on the Parser explicitly expects a FROM keyword:
https://github.com/sqlparser-rs/sqlparser-rs/blob/1e209d87415a5adfedccac8cee3e2860122e4acb/src/parser/mod.rs#L1682-L1692

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 a pull request may close this issue.

1 participant