From 8f76324352986287c04832f8e6450d4d2952a030 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 7 Mar 2011 22:53:32 +0200 Subject: [PATCH] Report Python errors from iterators with PLy_elog MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This improves reporting, as the error string now includes the actual Python exception. As a side effect, this no longer sets the errcode to ERRCODE_DATA_EXCEPTION, which might be considered a feature, as it's not documented and not clear why iterator errors should be treated differently. Jan Urbański --- src/pl/plpython/plpython.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index 4a9e2a4f18..43d332de20 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -1157,9 +1157,7 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure *proc) PLy_function_delete_args(proc); if (has_error) - ereport(ERROR, - (errcode(ERRCODE_DATA_EXCEPTION), - errmsg("error fetching next item from iterator"))); + PLy_elog(ERROR, "error fetching next item from iterator"); /* Disconnect from the SPI manager before returning */ if (SPI_finish() != SPI_OK_FINISH) -- 2.11.0