mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-08 01:15:00 +00:00
Support UNNEST
as a table factor for PostgreSQL (#968)
This commit is contained in:
parent
0480ee9886
commit
a16791d019
2 changed files with 28 additions and 1 deletions
|
@ -3450,3 +3450,30 @@ fn parse_create_table_with_alias() {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_join_constraint_unnest_alias() {
|
||||
assert_eq!(
|
||||
only(
|
||||
pg().verified_only_select("SELECT * FROM t1 JOIN UNNEST(t1.a) AS f ON c1 = c2")
|
||||
.from
|
||||
)
|
||||
.joins,
|
||||
vec![Join {
|
||||
relation: TableFactor::UNNEST {
|
||||
alias: table_alias("f"),
|
||||
array_exprs: vec![Expr::CompoundIdentifier(vec![
|
||||
Ident::new("t1"),
|
||||
Ident::new("a")
|
||||
])],
|
||||
with_offset: false,
|
||||
with_offset_alias: None
|
||||
},
|
||||
join_operator: JoinOperator::Inner(JoinConstraint::On(Expr::BinaryOp {
|
||||
left: Box::new(Expr::Identifier("c1".into())),
|
||||
op: BinaryOperator::Eq,
|
||||
right: Box::new(Expr::Identifier("c2".into())),
|
||||
})),
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue