"parallel= " information is not coming in pg_dumpall for create aggregate
Hi,
I checked in PG 9.6 , if we create an aggregate function with saying -
parallel=safe/restricted/unsafe and then take
a pg_dumpall of the entire cluster , "parallel= " is missing from create
aggregate syntax
Steps to reproduce -
.)connect to psql terminal and create an aggregate function
postgres=# CREATE AGGREGATE unsafe_sum100 (float8)
(
stype = float8,
sfunc = float8pl,
mstype = float8,
msfunc = float8pl,
minvfunc = float8mi,
*parallel=safe*);
CREATE AGGREGATE
.)perform pg_dumpall against that cluster
.)check the content of create aggregate unsafe_sum100 in the file
"
-
-- Name: unsafe_sum100(double precision); Type: AGGREGATE; Schema:
public; Owner: centos
--
CREATE AGGREGATE unsafe_sum100(double precision) (
SFUNC = float8pl,
STYPE = double precision,
MSFUNC = float8pl,
MINVFUNC = float8mi,
MSTYPE = double precision
);
"
--
regards,tushar
On Mon, Apr 18, 2016 at 5:30 AM, tushar <tushar.ahuja@enterprisedb.com>
wrote:
Hi,
I checked in PG 9.6 , if we create an aggregate function with saying -
parallel=safe/restricted/unsafe and then take
a pg_dumpall of the entire cluster , "parallel= " is missing from create
aggregate syntax
Steps to reproduce -
.)connect to psql terminal and create an aggregate function
postgres=# CREATE AGGREGATE unsafe_sum100 (float8)
(
stype = float8,
sfunc = float8pl,
mstype = float8,
msfunc = float8pl,
minvfunc = float8mi,
parallel=safe);
CREATE AGGREGATE.)perform pg_dumpall against that cluster
.)check the content of create aggregate unsafe_sum100 in the file
"
-
-- Name: unsafe_sum100(double precision); Type: AGGREGATE; Schema:
public; Owner: centos
--
CREATE AGGREGATE unsafe_sum100(double precision) (
SFUNC = float8pl,
STYPE = double precision,
MSFUNC = float8pl,
MINVFUNC = float8mi,
MSTYPE = double precision
);"
You're correct... try the attached patch to fix it.
Regards,
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
Show quoted text
Timbira: http://www.timbira.com.br
Blog: http://fabriziomello.github.io
Linkedin: http://br.linkedin.com/in/fabriziomello
Twitter: http://twitter.com/fabriziomello
Github: http://github.com/fabriziomello
Attachments:
fix-dump-aggregate-parallel_v1.patchtext/x-diff; charset=US-ASCII; name=fix-dump-aggregate-parallel_v1.patchDownload
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index e1e5bee..396c03d 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -13274,6 +13274,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
int i_agginitval;
int i_aggminitval;
int i_convertok;
+ int i_proparallel;
const char *aggtransfn;
const char *aggfinalfn;
const char *aggcombinefn;
@@ -13295,6 +13296,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
const char *agginitval;
const char *aggminitval;
bool convertok;
+ const char *proparallel;
/* Skip if not to be dumped */
if (!agginfo->aggfn.dobj.dump || dopt->dataOnly)
@@ -13324,7 +13326,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
"aggmtransspace, aggminitval, "
"true AS convertok, "
"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 "
"WHERE a.aggfnoid = p.oid "
"AND p.oid = '%u'::pg_catalog.oid",
@@ -13472,6 +13475,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
i_agginitval = PQfnumber(res, "agginitval");
i_aggminitval = PQfnumber(res, "aggminitval");
i_convertok = PQfnumber(res, "convertok");
+ i_proparallel = PQfnumber(res, "proparallel");
aggtransfn = PQgetvalue(res, 0, i_aggtransfn);
aggfinalfn = PQgetvalue(res, 0, i_aggfinalfn);
@@ -13511,6 +13515,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
aggsig_tag = format_aggregate_signature(agginfo, fout, false);
+ if (i_proparallel != -1)
+ proparallel = PQgetvalue(res, 0, PQfnumber(res, "proparallel"));
+ else
+ proparallel = NULL;
+
if (!convertok)
{
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)
if (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
*/
On Mon, Apr 18, 2016 at 10:47 AM, Fabrízio de Royes Mello
<fabriziomello@gmail.com> wrote:
I checked in PG 9.6 , if we create an aggregate function with saying -
parallel=safe/restricted/unsafe and then take
a pg_dumpall of the entire cluster , "parallel= " is missing from create
aggregate syntaxSteps to reproduce -
.)connect to psql terminal and create an aggregate function
postgres=# CREATE AGGREGATE unsafe_sum100 (float8)
(
stype = float8,
sfunc = float8pl,
mstype = float8,
msfunc = float8pl,
minvfunc = float8mi,
parallel=safe);
CREATE AGGREGATE.)perform pg_dumpall against that cluster
.)check the content of create aggregate unsafe_sum100 in the file
"
-
-- Name: unsafe_sum100(double precision); Type: AGGREGATE; Schema: public;
Owner: centos
--CREATE AGGREGATE unsafe_sum100(double precision) (
SFUNC = float8pl,
STYPE = double precision,
MSFUNC = float8pl,
MINVFUNC = float8mi,
MSTYPE = double precision
);"
You're correct... try the attached patch to fix it.
Nice catch, Tushar. Thanks for the patch, Fabrízio. Committed.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 04/21/2016 08:36 AM, Robert Haas wrote:
Nice catch, Tushar. Thanks for the patch, Fabrízio. Committed.
Thanks, Verified against the latest sources of PG9.6 - issue has been
fixed now.
--
regards,tushar
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Thu, Apr 21, 2016 at 12:06 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Mon, Apr 18, 2016 at 10:47 AM, Fabrízio de Royes Mello
<fabriziomello@gmail.com> wrote:I checked in PG 9.6 , if we create an aggregate function with saying -
parallel=safe/restricted/unsafe and then take
a pg_dumpall of the entire cluster , "parallel= " is missing from
create
aggregate syntax
Steps to reproduce -
.)connect to psql terminal and create an aggregate function
postgres=# CREATE AGGREGATE unsafe_sum100 (float8)
(
stype = float8,
sfunc = float8pl,
mstype = float8,
msfunc = float8pl,
minvfunc = float8mi,
parallel=safe);
CREATE AGGREGATE.)perform pg_dumpall against that cluster
.)check the content of create aggregate unsafe_sum100 in the file
"
-
-- Name: unsafe_sum100(double precision); Type: AGGREGATE; Schema:
public;
Owner: centos
--CREATE AGGREGATE unsafe_sum100(double precision) (
SFUNC = float8pl,
STYPE = double precision,
MSFUNC = float8pl,
MINVFUNC = float8mi,
MSTYPE = double precision
);"
You're correct... try the attached patch to fix it.
Nice catch, Tushar. Thanks for the patch, Fabrízio. Committed.
You're welcome!
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
Show quoted text
Timbira: http://www.timbira.com.br
Blog: http://fabriziomello.github.io
Linkedin: http://br.linkedin.com/in/fabriziomello
Twitter: http://twitter.com/fabriziomello
Github: http://github.com/fabriziomello