@@ -3884,6 +3884,43 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)
3884
3884
}
3885
3885
}
3886
3886
3887
+ /*
3888
+ * Evaluate a JSON constructor expression.
3889
+ */
3890
+ void
3891
+ ExecEvalJsonConstructor (ExprState * state , ExprEvalStep * op ,
3892
+ ExprContext * econtext )
3893
+ {
3894
+ Datum res ;
3895
+ JsonConstructorExprState * jcstate = op -> d .json_constructor .jcstate ;
3896
+ JsonConstructorExpr * ctor = jcstate -> constructor ;
3897
+ bool is_jsonb = ctor -> returning -> format -> format_type == JS_FORMAT_JSONB ;
3898
+ bool isnull = false;
3899
+
3900
+ if (ctor -> type == JSCTOR_JSON_ARRAY )
3901
+ res = (is_jsonb ?
3902
+ jsonb_build_array_worker :
3903
+ json_build_array_worker ) (jcstate -> nargs ,
3904
+ jcstate -> arg_values ,
3905
+ jcstate -> arg_nulls ,
3906
+ jcstate -> arg_types ,
3907
+ jcstate -> constructor -> absent_on_null );
3908
+ else if (ctor -> type == JSCTOR_JSON_OBJECT )
3909
+ res = (is_jsonb ?
3910
+ jsonb_build_object_worker :
3911
+ json_build_object_worker ) (jcstate -> nargs ,
3912
+ jcstate -> arg_values ,
3913
+ jcstate -> arg_nulls ,
3914
+ jcstate -> arg_types ,
3915
+ jcstate -> constructor -> absent_on_null ,
3916
+ jcstate -> constructor -> unique );
3917
+ else
3918
+ elog (ERROR , "invalid JsonConstructorExpr type %d" , ctor -> type );
3919
+
3920
+ * op -> resvalue = res ;
3921
+ * op -> resnull = isnull ;
3922
+ }
3923
+
3887
3924
/*
3888
3925
* ExecEvalGroupingFunc
3889
3926
*
@@ -4447,40 +4484,3 @@ ExecAggPlainTransByRef(AggState *aggstate, AggStatePerTrans pertrans,
4447
4484
4448
4485
MemoryContextSwitchTo (oldContext );
4449
4486
}
4450
-
4451
- /*
4452
- * Evaluate a JSON constructor expression.
4453
- */
4454
- void
4455
- ExecEvalJsonConstructor (ExprState * state , ExprEvalStep * op ,
4456
- ExprContext * econtext )
4457
- {
4458
- Datum res ;
4459
- JsonConstructorExprState * jcstate = op -> d .json_constructor .jcstate ;
4460
- JsonConstructorExpr * ctor = jcstate -> constructor ;
4461
- bool is_jsonb = ctor -> returning -> format -> format_type == JS_FORMAT_JSONB ;
4462
- bool isnull = false;
4463
-
4464
- if (ctor -> type == JSCTOR_JSON_ARRAY )
4465
- res = (is_jsonb ?
4466
- jsonb_build_array_worker :
4467
- json_build_array_worker ) (jcstate -> nargs ,
4468
- jcstate -> arg_values ,
4469
- jcstate -> arg_nulls ,
4470
- jcstate -> arg_types ,
4471
- jcstate -> constructor -> absent_on_null );
4472
- else if (ctor -> type == JSCTOR_JSON_OBJECT )
4473
- res = (is_jsonb ?
4474
- jsonb_build_object_worker :
4475
- json_build_object_worker ) (jcstate -> nargs ,
4476
- jcstate -> arg_values ,
4477
- jcstate -> arg_nulls ,
4478
- jcstate -> arg_types ,
4479
- jcstate -> constructor -> absent_on_null ,
4480
- jcstate -> constructor -> unique );
4481
- else
4482
- elog (ERROR , "invalid JsonConstructorExpr type %d" , ctor -> type );
4483
-
4484
- * op -> resvalue = res ;
4485
- * op -> resnull = isnull ;
4486
- }
0 commit comments