]> granicus.if.org Git - postgresql/commitdiff
Fix pg_get_functiondef() to print a function's LEAKPROOF property.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 28 May 2015 15:24:37 +0000 (11:24 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 28 May 2015 15:24:37 +0000 (11:24 -0400)
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
src/backend/utils/adt/ruleutils.c

index 470db5705cc57fa7838fee543d2e3aafbb80444f..8382b1b224ce152aaa98372776e7dce8765afd91 100644 (file)
@@ -1134,11 +1134,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)
        {
index 967976723964c08b42ba75d08f39b52f6275a7b4..6400fa0de3dde64ed1ae69dc9ecc9be44ce0f9bc 100644 (file)
@@ -1974,6 +1974,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 ||