@@ -1237,23 +1237,12 @@ jsonb_build_object_noargs(PG_FUNCTION_ARGS)
12371237 PG_RETURN_POINTER (JsonbValueToJsonb (result .res ));
12381238}
12391239
1240- static Datum
1241- jsonb_build_array_worker (FunctionCallInfo fcinfo , int first_vararg ,
1240+ Datum
1241+ jsonb_build_array_worker (int nargs , Datum * args , bool * nulls , Oid * types ,
12421242 bool absent_on_null )
12431243{
1244- int nargs ;
12451244 int i ;
12461245 JsonbInState result ;
1247- Datum * args ;
1248- bool * nulls ;
1249- Oid * types ;
1250-
1251- /* build argument values to build the array */
1252- nargs = extract_variadic_args (fcinfo , first_vararg , true,
1253- & args , & types , & nulls );
1254-
1255- if (nargs < 0 )
1256- PG_RETURN_NULL ();
12571246
12581247 memset (& result , 0 , sizeof (JsonbInState ));
12591248
@@ -1269,7 +1258,7 @@ jsonb_build_array_worker(FunctionCallInfo fcinfo, int first_vararg,
12691258
12701259 result .res = pushJsonbValue (& result .parseState , WJB_END_ARRAY , NULL );
12711260
1272- PG_RETURN_POINTER (JsonbValueToJsonb (result .res ));
1261+ return JsonbPGetDatum (JsonbValueToJsonb (result .res ));
12731262}
12741263
12751264/*
@@ -1278,18 +1267,20 @@ jsonb_build_array_worker(FunctionCallInfo fcinfo, int first_vararg,
12781267Datum
12791268jsonb_build_array (PG_FUNCTION_ARGS )
12801269{
1281- return jsonb_build_array_worker (fcinfo , 0 , false);
1282- }
1270+ Datum * args ;
1271+ bool * nulls ;
1272+ Oid * types ;
1273+ /* build argument values to build the object */
1274+ int nargs = extract_variadic_args (fcinfo , 0 , true,
1275+ & args , & types , & nulls );
12831276
1284- /*
1285- * SQL function jsonb_build_array_ext(absent_on_null bool, variadic "any")
1286- */
1287- Datum
1288- jsonb_build_array_ext (PG_FUNCTION_ARGS )
1289- {
1290- return jsonb_build_array_worker (fcinfo , 1 , PG_GETARG_BOOL (0 ));
1277+ if (nargs < 0 )
1278+ PG_RETURN_NULL ();
1279+
1280+ PG_RETURN_DATUM (jsonb_build_array_worker (nargs , args , nulls , types , false));
12911281}
12921282
1283+
12931284/*
12941285 * degenerate case of jsonb_build_array where it gets 0 arguments.
12951286 */
0 commit comments