mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-23 07:24:10 +00:00
add a test for mssql table name in square brackets (#952)
This commit is contained in:
parent
9a39afbe07
commit
41e47cc013
1 changed files with 20 additions and 0 deletions
|
@ -324,6 +324,26 @@ fn parse_delimited_identifiers() {
|
|||
//TODO verified_stmt(r#"UPDATE foo SET "bar" = 5"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_table_name_in_square_brackets() {
|
||||
let select = ms().verified_only_select(r#"SELECT [a column] FROM [a schema].[a table]"#);
|
||||
if let TableFactor::Table { name, .. } = only(select.from).relation {
|
||||
assert_eq!(
|
||||
vec![
|
||||
Ident::with_quote('[', "a schema"),
|
||||
Ident::with_quote('[', "a table")
|
||||
],
|
||||
name.0
|
||||
);
|
||||
} else {
|
||||
panic!("Expecting TableFactor::Table");
|
||||
}
|
||||
assert_eq!(
|
||||
&Expr::Identifier(Ident::with_quote('[', "a column")),
|
||||
expr_from_projection(&select.projection[0]),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_like() {
|
||||
fn chk(negated: bool) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue