Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add negative test for except clause on wildcards #746

Merged
merged 1 commit into from Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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