Skip to content
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

DFParser cannot parse CopyIntoSnowflake #14372

Closed
osipovartem opened this issue Jan 30, 2025 · 0 comments · Fixed by #14382
Closed

DFParser cannot parse CopyIntoSnowflake #14372

osipovartem opened this issue Jan 30, 2025 · 0 comments · Fixed by #14382
Labels
bug Something isn't working

Comments

@osipovartem
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant