Skip to content

DFParser cannot parse CopyIntoSnowflake #14372

@osipovartem

Description

@osipovartem

Describe the bug

DFParser::parse_sql_with_dialect(sql, dialect.as_ref())?

trying to parse COPY INTO .. as Statement::CopyTo even if we set "snowflake" dialect where Statement::CopyIntoSnowflake already supported.

The possible reason of the issue related to Keyword::COPY logic. We need to check if the next token != Keyword::INTO to pass such sql to sqlparser-rs

/// Parse a new expression
  pub fn parse_statement(&mut self) -> Result<Statement, ParserError> {
      match self.parser.peek_token().token {
          Token::Word(w) => {
              match w.keyword {
                  Keyword::COPY => {
                      self.parser.next_token();
                      self.parse_copy()
                  }
              }
          }
...

To Reproduce

No response

Expected behavior

With "snowflake" dialect COPY INTO statement should be parsed correctly as Statement::CopyIntoSnowflake

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions