File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -5462,6 +5462,8 @@ pub enum FunctionArgOperator {
54625462 Assignment ,
54635463 /// function(arg1 : value1)
54645464 Colon ,
5465+ /// function(arg1 VALUE value1)
5466+ Value ,
54655467}
54665468
54675469impl fmt:: Display for FunctionArgOperator {
@@ -5471,6 +5473,7 @@ impl fmt::Display for FunctionArgOperator {
54715473 FunctionArgOperator :: RightArrow => f. write_str ( "=>" ) ,
54725474 FunctionArgOperator :: Assignment => f. write_str ( ":=" ) ,
54735475 FunctionArgOperator :: Colon => f. write_str ( ":" ) ,
5476+ FunctionArgOperator :: Value => f. write_str ( "VALUE" ) ,
54745477 }
54755478 }
54765479}
Original file line number Diff line number Diff line change @@ -11411,6 +11411,7 @@ impl<'a> Parser<'a> {
1141111411 Token::Colon if self.dialect.supports_named_fn_args_with_colon_operator() => {
1141211412 Ok(FunctionArgOperator::Colon)
1141311413 }
11414+ Token::Word(w) if w.value.to_uppercase() == "VALUE" => Ok(FunctionArgOperator::Value),
1141411415 _ => {
1141511416 self.prev_token();
1141611417 self.expected("argument operator", tok)
Original file line number Diff line number Diff line change @@ -2812,6 +2812,19 @@ fn test_json() {
28122812 ) ;
28132813}
28142814
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+
28152828#[ test]
28162829fn parse_json_table_is_not_reserved ( ) {
28172830 // 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