add a test for mssql table name in square brackets (#952)

This commit is contained in:
Ophir LOJKINE 2023-08-21 19:21:45 +02:00 committed by GitHub
parent 9a39afbe07
commit 41e47cc013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {