File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -5528,6 +5528,8 @@ pub enum FunctionArgOperator {
55285528 Assignment ,
55295529 /// function(arg1 : value1)
55305530 Colon ,
5531+ /// function(arg1 VALUE value1)
5532+ Value ,
55315533}
55325534
55335535impl fmt:: Display for FunctionArgOperator {
@@ -5537,6 +5539,7 @@ impl fmt::Display for FunctionArgOperator {
55375539 FunctionArgOperator :: RightArrow => f. write_str ( "=>" ) ,
55385540 FunctionArgOperator :: Assignment => f. write_str ( ":=" ) ,
55395541 FunctionArgOperator :: Colon => f. write_str ( ":" ) ,
5542+ FunctionArgOperator :: Value => f. write_str ( "VALUE" ) ,
55405543 }
55415544 }
55425545}
Original file line number Diff line number Diff line change @@ -11482,6 +11482,9 @@ impl<'a> Parser<'a> {
1148211482 }
1148311483
1148411484 fn parse_function_named_arg_operator(&mut self) -> Result<FunctionArgOperator, ParserError> {
11485+ if self.parse_keyword(Keyword::VALUE) {
11486+ return Ok(FunctionArgOperator::Value);
11487+ }
1148511488 let tok = self.next_token();
1148611489 match tok.token {
1148711490 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() {
28242824 ) ;
28252825}
28262826
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+
28272840#[ test]
28282841fn parse_json_table_is_not_reserved ( ) {
28292842 // 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