@@ -3611,21 +3611,17 @@ transformJsonArrayQueryConstructor(ParseState *pstate,
36113611static Node *
36123612transformJsonAggConstructor (ParseState * pstate , JsonAggConstructor * agg_ctor ,
36133613 JsonReturning * returning , List * args ,
3614- const char * aggfn , Oid aggtype ,
3614+ Oid aggfnoid , Oid aggtype ,
36153615 JsonConstructorType ctor_type ,
36163616 bool unique , bool absent_on_null )
36173617{
3618- Oid aggfnoid ;
36193618 Node * node ;
36203619 Expr * aggfilter ;
36213620
36223621 aggfilter = agg_ctor -> agg_filter ? (Expr * )
36233622 transformWhereClause (pstate , agg_ctor -> agg_filter ,
36243623 EXPR_KIND_FILTER , "FILTER" ) : NULL ;
36253624
3626- aggfnoid = DatumGetInt32 (DirectFunctionCall1 (regprocin ,
3627- CStringGetDatum (aggfn )));
3628-
36293625 if (agg_ctor -> over )
36303626 {
36313627 /* window function */
@@ -3703,7 +3699,7 @@ transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg)
37033699 Node * key ;
37043700 Node * val ;
37053701 List * args ;
3706- const char * aggfnname ;
3702+ Oid aggfnoid ;
37073703 Oid aggtype ;
37083704
37093705 key = transformExprRecurse (pstate , (Node * ) agg -> arg -> key );
@@ -3717,33 +3713,33 @@ transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg)
37173713 {
37183714 if (agg -> absent_on_null )
37193715 if (agg -> unique )
3720- aggfnname = "pg_catalog.jsonb_object_agg_unique_strict" ;
3716+ aggfnoid = F_JSONB_OBJECT_AGG_UNIQUE_STRICT ;
37213717 else
3722- aggfnname = "pg_catalog.jsonb_object_agg_strict" ;
3718+ aggfnoid = F_JSONB_OBJECT_AGG_STRICT ;
37233719 else if (agg -> unique )
3724- aggfnname = "pg_catalog.jsonb_object_agg_unique" ;
3720+ aggfnoid = F_JSONB_OBJECT_AGG_UNIQUE ;
37253721 else
3726- aggfnname = "pg_catalog.jsonb_object_agg" ;
3722+ aggfnoid = F_JSONB_OBJECT_AGG ;
37273723
37283724 aggtype = JSONBOID ;
37293725 }
37303726 else
37313727 {
37323728 if (agg -> absent_on_null )
37333729 if (agg -> unique )
3734- aggfnname = "pg_catalog.json_object_agg_unique_strict" ;
3730+ aggfnoid = F_JSON_OBJECT_AGG_UNIQUE_STRICT ;
37353731 else
3736- aggfnname = "pg_catalog.json_object_agg_strict" ;
3732+ aggfnoid = F_JSON_OBJECT_AGG_STRICT ;
37373733 else if (agg -> unique )
3738- aggfnname = "pg_catalog.json_object_agg_unique" ;
3734+ aggfnoid = F_JSON_OBJECT_AGG_UNIQUE ;
37393735 else
3740- aggfnname = "pg_catalog.json_object_agg" ;
3736+ aggfnoid = F_JSON_OBJECT_AGG ;
37413737
37423738 aggtype = JSONOID ;
37433739 }
37443740
37453741 return transformJsonAggConstructor (pstate , agg -> constructor , returning ,
3746- args , aggfnname , aggtype ,
3742+ args , aggfnoid , aggtype ,
37473743 JSCTOR_JSON_OBJECTAGG ,
37483744 agg -> unique , agg -> absent_on_null );
37493745}
@@ -3760,7 +3756,7 @@ transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg)
37603756{
37613757 JsonReturning * returning ;
37623758 Node * arg ;
3763- const char * aggfnname ;
3759+ Oid aggfnoid ;
37643760 Oid aggtype ;
37653761
37663762 arg = transformJsonValueExpr (pstate , agg -> arg , JS_FORMAT_DEFAULT );
@@ -3770,19 +3766,17 @@ transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg)
37703766
37713767 if (returning -> format -> format_type == JS_FORMAT_JSONB )
37723768 {
3773- aggfnname = agg -> absent_on_null ?
3774- "pg_catalog.jsonb_agg_strict" : "pg_catalog.jsonb_agg" ;
3769+ aggfnoid = agg -> absent_on_null ? F_JSONB_AGG_STRICT : F_JSONB_AGG ;
37753770 aggtype = JSONBOID ;
37763771 }
37773772 else
37783773 {
3779- aggfnname = agg -> absent_on_null ?
3780- "pg_catalog.json_agg_strict" : "pg_catalog.json_agg" ;
3774+ aggfnoid = agg -> absent_on_null ? F_JSON_AGG_STRICT : F_JSON_AGG ;
37813775 aggtype = JSONOID ;
37823776 }
37833777
37843778 return transformJsonAggConstructor (pstate , agg -> constructor , returning ,
3785- list_make1 (arg ), aggfnname , aggtype ,
3779+ list_make1 (arg ), aggfnoid , aggtype ,
37863780 JSCTOR_JSON_ARRAYAGG ,
37873781 false, agg -> absent_on_null );
37883782}
0 commit comments