@@ -3611,21 +3611,17 @@ transformJsonArrayQueryConstructor(ParseState *pstate,
3611
3611
static Node *
3612
3612
transformJsonAggConstructor (ParseState * pstate , JsonAggConstructor * agg_ctor ,
3613
3613
JsonReturning * returning , List * args ,
3614
- const char * aggfn , Oid aggtype ,
3614
+ Oid aggfnoid , Oid aggtype ,
3615
3615
JsonConstructorType ctor_type ,
3616
3616
bool unique , bool absent_on_null )
3617
3617
{
3618
- Oid aggfnoid ;
3619
3618
Node * node ;
3620
3619
Expr * aggfilter ;
3621
3620
3622
3621
aggfilter = agg_ctor -> agg_filter ? (Expr * )
3623
3622
transformWhereClause (pstate , agg_ctor -> agg_filter ,
3624
3623
EXPR_KIND_FILTER , "FILTER" ) : NULL ;
3625
3624
3626
- aggfnoid = DatumGetInt32 (DirectFunctionCall1 (regprocin ,
3627
- CStringGetDatum (aggfn )));
3628
-
3629
3625
if (agg_ctor -> over )
3630
3626
{
3631
3627
/* window function */
@@ -3703,7 +3699,7 @@ transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg)
3703
3699
Node * key ;
3704
3700
Node * val ;
3705
3701
List * args ;
3706
- const char * aggfnname ;
3702
+ Oid aggfnoid ;
3707
3703
Oid aggtype ;
3708
3704
3709
3705
key = transformExprRecurse (pstate , (Node * ) agg -> arg -> key );
@@ -3717,33 +3713,33 @@ transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg)
3717
3713
{
3718
3714
if (agg -> absent_on_null )
3719
3715
if (agg -> unique )
3720
- aggfnname = "pg_catalog.jsonb_object_agg_unique_strict" ;
3716
+ aggfnoid = F_JSONB_OBJECT_AGG_UNIQUE_STRICT ;
3721
3717
else
3722
- aggfnname = "pg_catalog.jsonb_object_agg_strict" ;
3718
+ aggfnoid = F_JSONB_OBJECT_AGG_STRICT ;
3723
3719
else if (agg -> unique )
3724
- aggfnname = "pg_catalog.jsonb_object_agg_unique" ;
3720
+ aggfnoid = F_JSONB_OBJECT_AGG_UNIQUE ;
3725
3721
else
3726
- aggfnname = "pg_catalog.jsonb_object_agg" ;
3722
+ aggfnoid = F_JSONB_OBJECT_AGG ;
3727
3723
3728
3724
aggtype = JSONBOID ;
3729
3725
}
3730
3726
else
3731
3727
{
3732
3728
if (agg -> absent_on_null )
3733
3729
if (agg -> unique )
3734
- aggfnname = "pg_catalog.json_object_agg_unique_strict" ;
3730
+ aggfnoid = F_JSON_OBJECT_AGG_UNIQUE_STRICT ;
3735
3731
else
3736
- aggfnname = "pg_catalog.json_object_agg_strict" ;
3732
+ aggfnoid = F_JSON_OBJECT_AGG_STRICT ;
3737
3733
else if (agg -> unique )
3738
- aggfnname = "pg_catalog.json_object_agg_unique" ;
3734
+ aggfnoid = F_JSON_OBJECT_AGG_UNIQUE ;
3739
3735
else
3740
- aggfnname = "pg_catalog.json_object_agg" ;
3736
+ aggfnoid = F_JSON_OBJECT_AGG ;
3741
3737
3742
3738
aggtype = JSONOID ;
3743
3739
}
3744
3740
3745
3741
return transformJsonAggConstructor (pstate , agg -> constructor , returning ,
3746
- args , aggfnname , aggtype ,
3742
+ args , aggfnoid , aggtype ,
3747
3743
JSCTOR_JSON_OBJECTAGG ,
3748
3744
agg -> unique , agg -> absent_on_null );
3749
3745
}
@@ -3760,7 +3756,7 @@ transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg)
3760
3756
{
3761
3757
JsonReturning * returning ;
3762
3758
Node * arg ;
3763
- const char * aggfnname ;
3759
+ Oid aggfnoid ;
3764
3760
Oid aggtype ;
3765
3761
3766
3762
arg = transformJsonValueExpr (pstate , agg -> arg , JS_FORMAT_DEFAULT );
@@ -3770,19 +3766,17 @@ transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg)
3770
3766
3771
3767
if (returning -> format -> format_type == JS_FORMAT_JSONB )
3772
3768
{
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 ;
3775
3770
aggtype = JSONBOID ;
3776
3771
}
3777
3772
else
3778
3773
{
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 ;
3781
3775
aggtype = JSONOID ;
3782
3776
}
3783
3777
3784
3778
return transformJsonAggConstructor (pstate , agg -> constructor , returning ,
3785
- list_make1 (arg ), aggfnname , aggtype ,
3779
+ list_make1 (arg ), aggfnoid , aggtype ,
3786
3780
JSCTOR_JSON_ARRAYAGG ,
3787
3781
false, agg -> absent_on_null );
3788
3782
}
0 commit comments