Skip to content

Commit 650c53d

Browse files
authored
Add negative test for except clause on wildcards (#746)
1 parent 01fd20f commit 650c53d

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

tests/sqlparser_bigquery.rs

+7-21
Original file line numberDiff line numberDiff line change
@@ -283,27 +283,13 @@ fn test_select_wildcard_with_except() {
283283
_ => unreachable!(),
284284
};
285285

286-
match bigquery_and_generic().verified_stmt("SELECT * EXCEPT (col1, col2) FROM _table") {
287-
Statement::Query(query) => match *query.body {
288-
SetExpr::Select(select) => match &select.projection[0] {
289-
SelectItem::Wildcard(WildcardAdditionalOptions {
290-
opt_except: Some(except),
291-
..
292-
}) => {
293-
assert_eq!(
294-
*except,
295-
ExceptSelectItem {
296-
fist_elemnt: Ident::new("col1"),
297-
additional_elements: vec![Ident::new("col2")]
298-
}
299-
)
300-
}
301-
_ => unreachable!(),
302-
},
303-
_ => unreachable!(),
304-
},
305-
_ => unreachable!(),
306-
};
286+
assert_eq!(
287+
bigquery_and_generic()
288+
.parse_sql_statements("SELECT * EXCEPT () FROM employee_table")
289+
.unwrap_err()
290+
.to_string(),
291+
"sql parser error: Expected identifier, found: )"
292+
);
307293
}
308294

309295
fn bigquery() -> TestedDialects {

0 commit comments

Comments
 (0)