mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 18:57:21 +00:00
Fix SUBSTRING from/to argument construction for mssql (#947)
This commit is contained in:
parent
173a6db818
commit
8bbb85356c
7 changed files with 153 additions and 24 deletions
|
@ -5084,19 +5084,45 @@ fn parse_scalar_subqueries() {
|
|||
|
||||
#[test]
|
||||
fn parse_substring() {
|
||||
one_statement_parses_to("SELECT SUBSTRING('1')", "SELECT SUBSTRING('1')");
|
||||
let from_for_supported_dialects = TestedDialects {
|
||||
dialects: vec![
|
||||
Box::new(GenericDialect {}),
|
||||
Box::new(PostgreSqlDialect {}),
|
||||
Box::new(AnsiDialect {}),
|
||||
Box::new(SnowflakeDialect {}),
|
||||
Box::new(HiveDialect {}),
|
||||
Box::new(RedshiftSqlDialect {}),
|
||||
Box::new(MySqlDialect {}),
|
||||
Box::new(BigQueryDialect {}),
|
||||
Box::new(SQLiteDialect {}),
|
||||
Box::new(DuckDbDialect {}),
|
||||
],
|
||||
options: None,
|
||||
};
|
||||
|
||||
one_statement_parses_to(
|
||||
let from_for_unsupported_dialects = TestedDialects {
|
||||
dialects: vec![Box::new(MsSqlDialect {})],
|
||||
options: None,
|
||||
};
|
||||
|
||||
from_for_supported_dialects
|
||||
.one_statement_parses_to("SELECT SUBSTRING('1')", "SELECT SUBSTRING('1')");
|
||||
|
||||
from_for_supported_dialects.one_statement_parses_to(
|
||||
"SELECT SUBSTRING('1' FROM 1)",
|
||||
"SELECT SUBSTRING('1' FROM 1)",
|
||||
);
|
||||
|
||||
one_statement_parses_to(
|
||||
from_for_supported_dialects.one_statement_parses_to(
|
||||
"SELECT SUBSTRING('1' FROM 1 FOR 3)",
|
||||
"SELECT SUBSTRING('1' FROM 1 FOR 3)",
|
||||
);
|
||||
|
||||
one_statement_parses_to("SELECT SUBSTRING('1' FOR 3)", "SELECT SUBSTRING('1' FOR 3)");
|
||||
from_for_unsupported_dialects
|
||||
.one_statement_parses_to("SELECT SUBSTRING('1', 1, 3)", "SELECT SUBSTRING('1', 1, 3)");
|
||||
|
||||
from_for_supported_dialects
|
||||
.one_statement_parses_to("SELECT SUBSTRING('1' FOR 3)", "SELECT SUBSTRING('1' FOR 3)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue