@@ -13274,6 +13274,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
13274
13274
int i_agginitval;
13275
13275
int i_aggminitval;
13276
13276
int i_convertok;
13277
+ int i_proparallel;
13277
13278
const char *aggtransfn;
13278
13279
const char *aggfinalfn;
13279
13280
const char *aggcombinefn;
@@ -13295,6 +13296,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
13295
13296
const char *agginitval;
13296
13297
const char *aggminitval;
13297
13298
bool convertok;
13299
+ const char *proparallel;
13298
13300
13299
13301
/* Skip if not to be dumped */
13300
13302
if (!agginfo->aggfn.dobj.dump || dopt->dataOnly)
@@ -13324,7 +13326,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
13324
13326
"aggmtransspace, aggminitval, "
13325
13327
"true AS convertok, "
13326
13328
"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 "
13328
13331
"FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p "
13329
13332
"WHERE a.aggfnoid = p.oid "
13330
13333
"AND p.oid = '%u'::pg_catalog.oid",
@@ -13472,6 +13475,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
13472
13475
i_agginitval = PQfnumber(res, "agginitval");
13473
13476
i_aggminitval = PQfnumber(res, "aggminitval");
13474
13477
i_convertok = PQfnumber(res, "convertok");
13478
+ i_proparallel = PQfnumber(res, "proparallel");
13475
13479
13476
13480
aggtransfn = PQgetvalue(res, 0, i_aggtransfn);
13477
13481
aggfinalfn = PQgetvalue(res, 0, i_aggfinalfn);
@@ -13511,6 +13515,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
13511
13515
13512
13516
aggsig_tag = format_aggregate_signature(agginfo, fout, false);
13513
13517
13518
+ if (i_proparallel != -1)
13519
+ proparallel = PQgetvalue(res, 0, PQfnumber(res, "proparallel"));
13520
+ else
13521
+ proparallel = NULL;
13522
+
13514
13523
if (!convertok)
13515
13524
{
13516
13525
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)
13622
13631
if (hypothetical)
13623
13632
appendPQExpBufferStr(details, ",\n HYPOTHETICAL");
13624
13633
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
+
13625
13645
/*
13626
13646
* DROP must be fully qualified in case same name appears in pg_catalog
13627
13647
*/
0 commit comments