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

Commit d4a9f55

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 269cb4f commit d4a9f55

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
@@ -1134,11 +1134,11 @@ AlterFunction(AlterFunctionStmt *stmt)
11341134
procForm->prosecdef = intVal(security_def_item->arg);
11351135
if (leakproof_item)
11361136
{
1137-
if (intVal(leakproof_item->arg) && !superuser())
1137+
procForm->proleakproof = intVal(leakproof_item->arg);
1138+
if (procForm->proleakproof && !superuser())
11381139
ereport(ERROR,
11391140
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
11401141
errmsg("only superuser can define a leakproof function")));
1141-
procForm->proleakproof = intVal(leakproof_item->arg);
11421142
}
11431143
if (cost_item)
11441144
{

src/backend/utils/adt/ruleutils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,8 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
19741974
appendStringInfoString(&buf, " STRICT");
19751975
if (proc->prosecdef)
19761976
appendStringInfoString(&buf, " SECURITY DEFINER");
1977+
if (proc->proleakproof)
1978+
appendStringInfoString(&buf, " LEAKPROOF");
19771979

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

0 commit comments

Comments
 (0)