File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -6240,7 +6240,7 @@ impl<'a> Parser<'a> {
6240
6240
// appearing alone in parentheses (e.g. `FROM (mytable)`)
6241
6241
self . expected ( "joined table" , self . peek_token ( ) )
6242
6242
}
6243
- } else if dialect_of ! ( self is BigQueryDialect | GenericDialect )
6243
+ } else if dialect_of ! ( self is BigQueryDialect | PostgreSqlDialect | GenericDialect )
6244
6244
&& self . parse_keyword ( Keyword :: UNNEST )
6245
6245
{
6246
6246
self . expect_token ( & Token :: LParen ) ?;
Original file line number Diff line number Diff line change @@ -3450,3 +3450,30 @@ fn parse_create_table_with_alias() {
3450
3450
_ => unreachable ! ( ) ,
3451
3451
}
3452
3452
}
3453
+
3454
+ #[ test]
3455
+ fn parse_join_constraint_unnest_alias ( ) {
3456
+ assert_eq ! (
3457
+ only(
3458
+ pg( ) . verified_only_select( "SELECT * FROM t1 JOIN UNNEST(t1.a) AS f ON c1 = c2" )
3459
+ . from
3460
+ )
3461
+ . joins,
3462
+ vec![ Join {
3463
+ relation: TableFactor :: UNNEST {
3464
+ alias: table_alias( "f" ) ,
3465
+ array_exprs: vec![ Expr :: CompoundIdentifier ( vec![
3466
+ Ident :: new( "t1" ) ,
3467
+ Ident :: new( "a" )
3468
+ ] ) ] ,
3469
+ with_offset: false ,
3470
+ with_offset_alias: None
3471
+ } ,
3472
+ join_operator: JoinOperator :: Inner ( JoinConstraint :: On ( Expr :: BinaryOp {
3473
+ left: Box :: new( Expr :: Identifier ( "c1" . into( ) ) ) ,
3474
+ op: BinaryOperator :: Eq ,
3475
+ right: Box :: new( Expr :: Identifier ( "c2" . into( ) ) ) ,
3476
+ } ) ) ,
3477
+ } ]
3478
+ ) ;
3479
+ }
You can’t perform that action at this time.
0 commit comments