]> granicus.if.org Git - postgresql/commitdiff
Improve message for errors in compiling anonymous PL/Python blocks
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 18 Jan 2011 22:03:57 +0000 (00:03 +0200)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 18 Jan 2011 22:04:46 +0000 (00:04 +0200)
The previous code would try to print out a null pointer.

Jan UrbaƄski

src/pl/plpython/plpython.c

index 03d6962ca0230bcf35109d8ea705217738228e0e..99424d35133625c8b1c0353e697e9533e4fbb313 100644 (file)
@@ -1625,7 +1625,11 @@ PLy_procedure_compile(PLyProcedure *proc, const char *src)
                        return;
        }
 
-       PLy_elog(ERROR, "could not compile PL/Python function \"%s\"", proc->proname);
+       if (proc->proname)
+               PLy_elog(ERROR, "could not compile PL/Python function \"%s\"",
+                                proc->proname);
+       else
+               PLy_elog(ERROR, "could not compile anonymous PL/Python code block");
 }
 
 static char *