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.
This commit is contained in:
parent
aa9eac45ea
commit
f46edf479e
|
@ -1190,11 +1190,11 @@ AlterFunction(AlterFunctionStmt *stmt)
|
||||||
procForm->prosecdef = intVal(security_def_item->arg);
|
procForm->prosecdef = intVal(security_def_item->arg);
|
||||||
if (leakproof_item)
|
if (leakproof_item)
|
||||||
{
|
{
|
||||||
if (intVal(leakproof_item->arg) && !superuser())
|
procForm->proleakproof = intVal(leakproof_item->arg);
|
||||||
|
if (procForm->proleakproof && !superuser())
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
errmsg("only superuser can define a leakproof function")));
|
errmsg("only superuser can define a leakproof function")));
|
||||||
procForm->proleakproof = intVal(leakproof_item->arg);
|
|
||||||
}
|
}
|
||||||
if (cost_item)
|
if (cost_item)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1985,6 +1985,8 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
|
||||||
appendStringInfoString(&buf, " STRICT");
|
appendStringInfoString(&buf, " STRICT");
|
||||||
if (proc->prosecdef)
|
if (proc->prosecdef)
|
||||||
appendStringInfoString(&buf, " SECURITY DEFINER");
|
appendStringInfoString(&buf, " SECURITY DEFINER");
|
||||||
|
if (proc->proleakproof)
|
||||||
|
appendStringInfoString(&buf, " LEAKPROOF");
|
||||||
|
|
||||||
/* This code for the default cost and rows should match functioncmds.c */
|
/* This code for the default cost and rows should match functioncmds.c */
|
||||||
if (proc->prolang == INTERNALlanguageId ||
|
if (proc->prolang == INTERNALlanguageId ||
|
||||||
|
|
Loading…
Reference in New Issue