Skip to content

Commit 571e326

Browse files
committed
chore: add test for wildcard replace
1 parent 0c0d088 commit 571e326

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/sqlparser_bigquery.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,24 @@ fn test_select_wildcard_with_except() {
313313
);
314314
}
315315

316+
#[test]
317+
fn test_select_wildcard_with_replace() {
318+
let select = bigquery_and_generic().verified_only_select(r#"WITH orders AS
319+
(SELECT 5 as order_id,
320+
"sprocket" as item_name,
321+
200 as quantity)
322+
SELECT * REPLACE ("widget" AS item_name)
323+
FROM orders;"#);
324+
let expected = SelectItem::Wildcard(WildcardAdditionalOptions {
325+
opt_except: Some(ExceptSelectItem {
326+
first_element: Ident::new("col_a"),
327+
additional_elements: vec![],
328+
}),
329+
..Default::default()
330+
});
331+
assert_eq!(expected, select.projection[0]);
332+
}
333+
316334
fn bigquery() -> TestedDialects {
317335
TestedDialects {
318336
dialects: vec![Box::new(BigQueryDialect {})],

0 commit comments

Comments
 (0)