Skip to content

Commit

Permalink
Add negative test for except clause on wildcards (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Dec 7, 2022
1 parent 01fd20f commit 650c53d
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions tests/sqlparser_bigquery.rs
Expand Up @@ -283,27 +283,13 @@ fn test_select_wildcard_with_except() {
_ => unreachable!(),
};

match bigquery_and_generic().verified_stmt("SELECT * EXCEPT (col1, col2) FROM _table") {
Statement::Query(query) => match *query.body {
SetExpr::Select(select) => match &select.projection[0] {
SelectItem::Wildcard(WildcardAdditionalOptions {
opt_except: Some(except),
..
}) => {
assert_eq!(
*except,
ExceptSelectItem {
fist_elemnt: Ident::new("col1"),
additional_elements: vec![Ident::new("col2")]
}
)
}
_ => unreachable!(),
},
_ => unreachable!(),
},
_ => unreachable!(),
};
assert_eq!(
bigquery_and_generic()
.parse_sql_statements("SELECT * EXCEPT () FROM employee_table")
.unwrap_err()
.to_string(),
"sql parser error: Expected identifier, found: )"
);
}

fn bigquery() -> TestedDialects {
Expand Down

0 comments on commit 650c53d

Please sign in to comment.