postgres.git / summary / log / commit / refs
commit f46edf479e2468a08caca2a03ec7e258930a7161
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu May 28 15:24:37 2015 +0000
First released in: 9.5.0, 9.2.12, 9.3.8, 9.4.3
Fix pg_get_functiondef() to print a function's LEAKPROOF property.
Seems to have been an oversight in the original leakproofness patch.
Per report and patch from Jeevan Chalke.
In passing, prettify some awkward leakproof-related code in AlterFunction.
src/backend/commands/functioncmds.c | 4 ++--
src/backend/utils/adt/ruleutils.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 3d220e9c7e6..4accf767bbf 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -1190,11 +1190,11 @@ AlterFunction(AlterFunctionStmt *stmt)
procForm->prosecdef = intVal(security_def_item->arg);
if (leakproof_item)
{
- if (intVal(leakproof_item->arg) && !superuser())
+ procForm->proleakproof = intVal(leakproof_item->arg);
+ if (procForm->proleakproof && !superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("only superuser can define a leakproof function")));
- procForm->proleakproof = intVal(leakproof_item->arg);
}
if (cost_item)
{
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 55171131518..e316951cf3f 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1985,6 +1985,8 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
appendStringInfoString(&buf, " STRICT");
if (proc->prosecdef)
appendStringInfoString(&buf, " SECURITY DEFINER");
+ if (proc->proleakproof)
+ appendStringInfoString(&buf, " LEAKPROOF");
/* This code for the default cost and rows should match functioncmds.c */
if (proc->prolang == INTERNALlanguageId ||
[parent: aa9eac45ea86]