Skip to content

Commit

Permalink
add a test for mssql table name in square brackets (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa authored Aug 21, 2023
1 parent 9a39afb commit 41e47cc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/sqlparser_mssql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 41e47cc

Please sign in to comment.