File tree 3 files changed +17
-0
lines changed
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -5462,6 +5462,8 @@ pub enum FunctionArgOperator {
5462
5462
Assignment ,
5463
5463
/// function(arg1 : value1)
5464
5464
Colon ,
5465
+ /// function(arg1 VALUE value1)
5466
+ Value ,
5465
5467
}
5466
5468
5467
5469
impl fmt:: Display for FunctionArgOperator {
@@ -5471,6 +5473,7 @@ impl fmt::Display for FunctionArgOperator {
5471
5473
FunctionArgOperator :: RightArrow => f. write_str ( "=>" ) ,
5472
5474
FunctionArgOperator :: Assignment => f. write_str ( ":=" ) ,
5473
5475
FunctionArgOperator :: Colon => f. write_str ( ":" ) ,
5476
+ FunctionArgOperator :: Value => f. write_str ( "VALUE" ) ,
5474
5477
}
5475
5478
}
5476
5479
}
Original file line number Diff line number Diff line change @@ -11411,6 +11411,7 @@ impl<'a> Parser<'a> {
11411
11411
Token::Colon if self.dialect.supports_named_fn_args_with_colon_operator() => {
11412
11412
Ok(FunctionArgOperator::Colon)
11413
11413
}
11414
+ Token::Word(w) if w.value.to_uppercase() == "VALUE" => Ok(FunctionArgOperator::Value),
11414
11415
_ => {
11415
11416
self.prev_token();
11416
11417
self.expected("argument operator", tok)
Original file line number Diff line number Diff line change @@ -2812,6 +2812,19 @@ fn test_json() {
2812
2812
) ;
2813
2813
}
2814
2814
2815
+ #[ test]
2816
+ fn test_json_object ( ) {
2817
+ match pg ( ) . verified_expr ( "JSON_OBJECT('name' VALUE 'value')" ) {
2818
+ Expr :: Function ( Function { args : FunctionArguments :: List ( FunctionArgumentList { args, .. } ) , .. } ) => {
2819
+ assert ! ( matches!(
2820
+ & args[ ..] ,
2821
+ & [ FunctionArg :: ExprNamed { operator: FunctionArgOperator :: Value , .. } ]
2822
+ ) ) ;
2823
+ }
2824
+ other => panic ! ( "Expected: JSON_OBJECT('name' VALUE 'value') to be parsed as a function, but got {other:?}" ) ,
2825
+ }
2826
+ }
2827
+
2815
2828
#[ test]
2816
2829
fn parse_json_table_is_not_reserved ( ) {
2817
2830
// JSON_TABLE is not a reserved keyword in PostgreSQL, even though it is in SQL:2023
You can’t perform that action at this time.
0 commit comments