Skip to content

Commit f3c67aa

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 44674d0 commit f3c67aa

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
@@ -1314,11 +1314,11 @@ AlterFunction(AlterFunctionStmt *stmt)
13141314
procForm->prosecdef = intVal(security_def_item->arg);
13151315
if (leakproof_item)
13161316
{
1317-
if (intVal(leakproof_item->arg) && !superuser())
1317+
procForm->proleakproof = intVal(leakproof_item->arg);
1318+
if (procForm->proleakproof && !superuser())
13181319
ereport(ERROR,
13191320
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
13201321
errmsg("only superuser can define a leakproof function")));
1321-
procForm->proleakproof = intVal(leakproof_item->arg);
13221322
}
13231323
if (cost_item)
13241324
{

src/backend/utils/adt/ruleutils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,6 +1769,8 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
17691769
appendStringInfoString(&buf, " STRICT");
17701770
if (proc->prosecdef)
17711771
appendStringInfoString(&buf, " SECURITY DEFINER");
1772+
if (proc->proleakproof)
1773+
appendStringInfoString(&buf, " LEAKPROOF");
17721774

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

0 commit comments

Comments
 (0)