@@ -13274,6 +13274,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
1327413274 int i_agginitval;
1327513275 int i_aggminitval;
1327613276 int i_convertok;
13277+ int i_proparallel;
1327713278 const char *aggtransfn;
1327813279 const char *aggfinalfn;
1327913280 const char *aggcombinefn;
@@ -13295,6 +13296,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
1329513296 const char *agginitval;
1329613297 const char *aggminitval;
1329713298 bool convertok;
13299+ const char *proparallel;
1329813300
1329913301 /* Skip if not to be dumped */
1330013302 if (!agginfo->aggfn.dobj.dump || dopt->dataOnly)
@@ -13324,7 +13326,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
1332413326 "aggmtransspace, aggminitval, "
1332513327 "true AS convertok, "
1332613328 "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, "
13327- "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs "
13329+ "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs, "
13330+ "p.proparallel "
1332813331 "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p "
1332913332 "WHERE a.aggfnoid = p.oid "
1333013333 "AND p.oid = '%u'::pg_catalog.oid",
@@ -13472,6 +13475,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
1347213475 i_agginitval = PQfnumber(res, "agginitval");
1347313476 i_aggminitval = PQfnumber(res, "aggminitval");
1347413477 i_convertok = PQfnumber(res, "convertok");
13478+ i_proparallel = PQfnumber(res, "proparallel");
1347513479
1347613480 aggtransfn = PQgetvalue(res, 0, i_aggtransfn);
1347713481 aggfinalfn = PQgetvalue(res, 0, i_aggfinalfn);
@@ -13511,6 +13515,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
1351113515
1351213516 aggsig_tag = format_aggregate_signature(agginfo, fout, false);
1351313517
13518+ if (i_proparallel != -1)
13519+ proparallel = PQgetvalue(res, 0, PQfnumber(res, "proparallel"));
13520+ else
13521+ proparallel = NULL;
13522+
1351413523 if (!convertok)
1351513524 {
1351613525 write_msg(NULL, "WARNING: aggregate function %s could not be dumped correctly for this database version; ignored\n",
@@ -13622,6 +13631,17 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
1362213631 if (hypothetical)
1362313632 appendPQExpBufferStr(details, ",\n HYPOTHETICAL");
1362413633
13634+ if (proparallel != NULL && proparallel[0] != PROPARALLEL_UNSAFE)
13635+ {
13636+ if (proparallel[0] == PROPARALLEL_SAFE)
13637+ appendPQExpBufferStr(details, ",\n PARALLEL = safe");
13638+ else if (proparallel[0] == PROPARALLEL_RESTRICTED)
13639+ appendPQExpBufferStr(details, ",\n PARALLEL = restricted");
13640+ else if (proparallel[0] != PROPARALLEL_UNSAFE)
13641+ exit_horribly(NULL, "unrecognized proparallel value for function \"%s\"\n",
13642+ agginfo->aggfn.dobj.name);
13643+ }
13644+
1362513645 /*
1362613646 * DROP must be fully qualified in case same name appears in pg_catalog
1362713647 */
0 commit comments