Commit b4e0f183 authored by Robert Haas's avatar Robert Haas

Add pg_dump support for the new PARALLEL option for aggregates.

This was an oversight in commit 41ea0c23.

Fabrízio de Royes Mello, per a report from Tushar Ahuja
parent 9c75e1a3
...@@ -13274,6 +13274,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) ...@@ -13274,6 +13274,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
int i_agginitval; int i_agginitval;
int i_aggminitval; int i_aggminitval;
int i_convertok; int i_convertok;
int i_proparallel;
const char *aggtransfn; const char *aggtransfn;
const char *aggfinalfn; const char *aggfinalfn;
const char *aggcombinefn; const char *aggcombinefn;
...@@ -13295,6 +13296,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) ...@@ -13295,6 +13296,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
const char *agginitval; const char *agginitval;
const char *aggminitval; const char *aggminitval;
bool convertok; bool convertok;
const char *proparallel;
/* Skip if not to be dumped */ /* Skip if not to be dumped */
if (!agginfo->aggfn.dobj.dump || dopt->dataOnly) if (!agginfo->aggfn.dobj.dump || dopt->dataOnly)
...@@ -13324,7 +13326,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo) ...@@ -13324,7 +13326,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
"aggmtransspace, aggminitval, " "aggmtransspace, aggminitval, "
"true AS convertok, " "true AS convertok, "
"pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, "
"pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs, "
"p.proparallel "
"FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p "
"WHERE a.aggfnoid = p.oid " "WHERE a.aggfnoid = p.oid "
"AND p.oid = '%u'::pg_catalog.oid", "AND p.oid = '%u'::pg_catalog.oid",
...@@ -13472,6 +13475,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) ...@@ -13472,6 +13475,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
i_agginitval = PQfnumber(res, "agginitval"); i_agginitval = PQfnumber(res, "agginitval");
i_aggminitval = PQfnumber(res, "aggminitval"); i_aggminitval = PQfnumber(res, "aggminitval");
i_convertok = PQfnumber(res, "convertok"); i_convertok = PQfnumber(res, "convertok");
i_proparallel = PQfnumber(res, "proparallel");
aggtransfn = PQgetvalue(res, 0, i_aggtransfn); aggtransfn = PQgetvalue(res, 0, i_aggtransfn);
aggfinalfn = PQgetvalue(res, 0, i_aggfinalfn); aggfinalfn = PQgetvalue(res, 0, i_aggfinalfn);
...@@ -13511,6 +13515,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo) ...@@ -13511,6 +13515,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
aggsig_tag = format_aggregate_signature(agginfo, fout, false); aggsig_tag = format_aggregate_signature(agginfo, fout, false);
if (i_proparallel != -1)
proparallel = PQgetvalue(res, 0, PQfnumber(res, "proparallel"));
else
proparallel = NULL;
if (!convertok) if (!convertok)
{ {
write_msg(NULL, "WARNING: aggregate function %s could not be dumped correctly for this database version; ignored\n", 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,6 +13631,17 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
if (hypothetical) if (hypothetical)
appendPQExpBufferStr(details, ",\n HYPOTHETICAL"); appendPQExpBufferStr(details, ",\n HYPOTHETICAL");
if (proparallel != NULL && proparallel[0] != PROPARALLEL_UNSAFE)
{
if (proparallel[0] == PROPARALLEL_SAFE)
appendPQExpBufferStr(details, ",\n PARALLEL = safe");
else if (proparallel[0] == PROPARALLEL_RESTRICTED)
appendPQExpBufferStr(details, ",\n PARALLEL = restricted");
else if (proparallel[0] != PROPARALLEL_UNSAFE)
exit_horribly(NULL, "unrecognized proparallel value for function \"%s\"\n",
agginfo->aggfn.dobj.name);
}
/* /*
* DROP must be fully qualified in case same name appears in pg_catalog * DROP must be fully qualified in case same name appears in pg_catalog
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment