Skip to content

Support Snowflake-specific EXTRACT syntax #1373

Closed
@seve-martinez

Description

@seve-martinez

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions