Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 27bae8d

Browse files
committed
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.
1 parent 5c8e43a commit 27bae8d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/backend/commands/functioncmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,11 +1103,11 @@ AlterFunction(AlterFunctionStmt *stmt)
11031103
procForm->prosecdef = intVal(security_def_item->arg);
11041104
if (leakproof_item)
11051105
{
1106-
if (intVal(leakproof_item->arg) && !superuser())
1106+
procForm->proleakproof = intVal(leakproof_item->arg);
1107+
if (procForm->proleakproof && !superuser())
11071108
ereport(ERROR,
11081109
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
11091110
errmsg("only superuser can define a leakproof function")));
1110-
procForm->proleakproof = intVal(leakproof_item->arg);
11111111
}
11121112
if (cost_item)
11131113
{

src/backend/utils/adt/ruleutils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,6 +1944,8 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
19441944
appendStringInfoString(&buf, " STRICT");
19451945
if (proc->prosecdef)
19461946
appendStringInfoString(&buf, " SECURITY DEFINER");
1947+
if (proc->proleakproof)
1948+
appendStringInfoString(&buf, " LEAKPROOF");
19471949

19481950
/* This code for the default cost and rows should match functioncmds.c */
19491951
if (proc->prolang == INTERNALlanguageId ||

0 commit comments

Comments
 (0)