Parallel indicators not written by pg_get_functiondef

Started by Feike Steenbergenover 9 years ago4 messages
#1Feike Steenbergen
feikesteenbergen@gmail.com
1 attachment(s)

pg_get_functiondef(oid) does not return the PARALLEL indicators.

Attached a small patch to have pg_get_functiondef actually add these
indicators, using commit 7aea8e4f2 (pg_dump.c) as a guide.

The logic is the same as with the volatility: we only append non-default
indicators.

Feike Steenbergen

Attachments:

add_parallel_indicators_to_get_functiondef.patchapplication/octet-stream; name=add_parallel_indicators_to_get_functiondef.patchDownload
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 2b47e95..c69ed3e 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1988,6 +1988,17 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
 		case PROVOLATILE_VOLATILE:
 			break;
 	}
+	switch (proc->proparallel)
+	{
+		case PROPARALLEL_SAFE:
+			appendStringInfoString(&buf, " PARALLEL SAFE");
+			break;
+		case PROPARALLEL_RESTRICTED:
+			appendStringInfoString(&buf, " PARALLEL RESTRICTED");
+			break;
+		case PROPARALLEL_UNSAFE:
+			break;
+	}
 	if (proc->proisstrict)
 		appendStringInfoString(&buf, " STRICT");
 	if (proc->prosecdef)
#2Michael Paquier
michael.paquier@gmail.com
In reply to: Feike Steenbergen (#1)
Re: Parallel indicators not written by pg_get_functiondef

On Fri, Apr 15, 2016 at 8:48 PM, Feike Steenbergen
<feikesteenbergen@gmail.com> wrote:

pg_get_functiondef(oid) does not return the PARALLEL indicators.

Attached a small patch to have pg_get_functiondef actually add these
indicators, using commit 7aea8e4f2 (pg_dump.c) as a guide.

The logic is the same as with the volatility: we only append non-default
indicators.

+1 for a good catch. Your patch is correct.
-- 
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Feike Steenbergen
feikesteenbergen@gmail.com
In reply to: Michael Paquier (#2)
Re: Parallel indicators not written by pg_get_functiondef

This patch is redundant as of
commit 2ac3be2e763d9b971352819f285dd51519e0aeb9

(Ashutosh Sharma diagnosed and patched the same problem)

On 15 April 2016 at 14:13, Michael Paquier <michael.paquier@gmail.com>
wrote:

Show quoted text

On Fri, Apr 15, 2016 at 8:48 PM, Feike Steenbergen
<feikesteenbergen@gmail.com> wrote:

pg_get_functiondef(oid) does not return the PARALLEL indicators.

Attached a small patch to have pg_get_functiondef actually add these
indicators, using commit 7aea8e4f2 (pg_dump.c) as a guide.

The logic is the same as with the volatility: we only append non-default
indicators.

+1 for a good catch. Your patch is correct.
--
Michael
#4Robert Haas
robertmhaas@gmail.com
In reply to: Feike Steenbergen (#3)
Re: Parallel indicators not written by pg_get_functiondef

On Wed, Apr 27, 2016 at 3:02 AM, Feike Steenbergen
<feikesteenbergen@gmail.com> wrote:

This patch is redundant as of commit
2ac3be2e763d9b971352819f285dd51519e0aeb9

(Ashutosh Sharma diagnosed and patched the same problem)

Oops. I completely failed to notice this prior report.

Sorry about that.

--
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