diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2009-11-03 11:05:03 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2009-11-03 11:05:03 +0000 |
commit | 2e3b16c8ba22991c4c1e165cf02050ca89309c05 (patch) | |
tree | 126af718d8bcf6500b9e3b9e72e185185776de36 /src/pl/plpython/plpython.c | |
parent | 2fe1b4dd651917aad2accac7ba8adb44d9f54930 (diff) | |
download | postgresql-2e3b16c8ba22991c4c1e165cf02050ca89309c05.tar.gz postgresql-2e3b16c8ba22991c4c1e165cf02050ca89309c05.zip |
Improve PL/Python elog output
When the elog functions (plpy.info etc.) get a single argument, just print
that argument instead of printing the single-member tuple like ('foo',).
Diffstat (limited to 'src/pl/plpython/plpython.c')
-rw-r--r-- | src/pl/plpython/plpython.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index 43b1db790a1..820641708c7 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -1,7 +1,7 @@ /********************************************************************** * plpython.c - python as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.131 2009/11/03 09:35:18 petere Exp $ + * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.132 2009/11/03 11:05:02 petere Exp $ * ********************************************************************* */ @@ -3080,7 +3080,16 @@ PLy_output(volatile int level, PyObject *self, PyObject *args) char *volatile sv; volatile MemoryContext oldcontext; - so = PyObject_Str(args); + if (PyTuple_Size(args) == 1) + { + /* Treat single argument specially to avoid undesirable + * ('tuple',) decoration. */ + PyObject *o; + PyArg_UnpackTuple(args, "plpy.elog", 1, 1, &o); + so = PyObject_Str(o); + } + else + so = PyObject_Str(args); if (so == NULL || ((sv = PyString_AsString(so)) == NULL)) { level = ERROR; |