diff --git a/tests/sqlparser_mssql.rs b/tests/sqlparser_mssql.rs index 56fbd576..0bb2ba3d 100644 --- a/tests/sqlparser_mssql.rs +++ b/tests/sqlparser_mssql.rs @@ -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) {