tv42 opened a new issue, #1519:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1519
This bug rhymes with #1244.
`parse_sql` normally doesn't care whether a single statement is terminated
by a semicolon or end of string, but when parsing Snowflake syntax `COPY INTO`
it does.
This deviation seems like a bug.
Discovered on sqlparser v0.51.0, tested on v0.52.0:
```rust
use sqlparser::{
dialect::SnowflakeDialect,
parser::{Parser, ParserError},
};
fn main() {
let dialect = SnowflakeDialect {};
// With other SQL, semicolon being there or not does not seem to matter:
{
let no_semicolon = Parser::parse_sql(&dialect, "select 1");
assert!(no_semicolon.is_ok());
}
{
let with_semicolon = Parser::parse_sql(&dialect, "select 1;");
assert!(with_semicolon.is_ok());
}
// With the SnowFlake COPY INTO statement, it does seem to matter.
// Parsing only works when the semicolon is omitted:
{
let no_semicolon = Parser::parse_sql(&dialect, "COPY INTO foo FROM
@bar");
println!("no semicolon: {no_semicolon:?}");
assert!(no_semicolon.is_ok());
}
{
// BUG
let with_semicolon = Parser::parse_sql(&dialect, "COPY INTO foo FROM
@bar;");
println!("with semicolon: {with_semicolon:?}");
assert_eq!(
with_semicolon,
Err(ParserError::ParserError(
"Expected: stage name identifier, found: EOF".to_string()
))
);
}
}
```
--
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]