File tree 3 files changed +19
-0
lines changed
3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -5528,6 +5528,8 @@ pub enum FunctionArgOperator {
5528
5528
Assignment ,
5529
5529
/// function(arg1 : value1)
5530
5530
Colon ,
5531
+ /// function(arg1 VALUE value1)
5532
+ Value ,
5531
5533
}
5532
5534
5533
5535
impl fmt:: Display for FunctionArgOperator {
@@ -5537,6 +5539,7 @@ impl fmt::Display for FunctionArgOperator {
5537
5539
FunctionArgOperator :: RightArrow => f. write_str ( "=>" ) ,
5538
5540
FunctionArgOperator :: Assignment => f. write_str ( ":=" ) ,
5539
5541
FunctionArgOperator :: Colon => f. write_str ( ":" ) ,
5542
+ FunctionArgOperator :: Value => f. write_str ( "VALUE" ) ,
5540
5543
}
5541
5544
}
5542
5545
}
Original file line number Diff line number Diff line change @@ -11482,6 +11482,9 @@ impl<'a> Parser<'a> {
11482
11482
}
11483
11483
11484
11484
fn parse_function_named_arg_operator(&mut self) -> Result<FunctionArgOperator, ParserError> {
11485
+ if self.parse_keyword(Keyword::VALUE) {
11486
+ return Ok(FunctionArgOperator::Value);
11487
+ }
11485
11488
let tok = self.next_token();
11486
11489
match tok.token {
11487
11490
Token::RArrow if self.dialect.supports_named_fn_args_with_rarrow_operator() => {
Original file line number Diff line number Diff line change @@ -2824,6 +2824,19 @@ fn test_json() {
2824
2824
) ;
2825
2825
}
2826
2826
2827
+ #[ test]
2828
+ fn test_fn_arg_with_value_operator ( ) {
2829
+ match pg ( ) . verified_expr ( "JSON_OBJECT('name' VALUE 'value')" ) {
2830
+ Expr :: Function ( Function { args : FunctionArguments :: List ( FunctionArgumentList { args, .. } ) , .. } ) => {
2831
+ assert ! ( matches!(
2832
+ & args[ ..] ,
2833
+ & [ FunctionArg :: ExprNamed { operator: FunctionArgOperator :: Value , .. } ]
2834
+ ) , "Invalid function argument: {:?}" , args) ;
2835
+ }
2836
+ other => panic ! ( "Expected: JSON_OBJECT('name' VALUE 'value') to be parsed as a function, but got {other:?}" ) ,
2837
+ }
2838
+ }
2839
+
2827
2840
#[ test]
2828
2841
fn parse_json_table_is_not_reserved ( ) {
2829
2842
// 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