From 804d13adfd2f66c70d8d95a606dde621b3213179 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 7 Mar 2011 23:01:54 +0200 Subject: [PATCH] Fix behavior when raising plpy.Fatal() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It should cause a elog(FATAL) error, and it fact it was simply causing a elog(ERROR). Jan Urbański --- src/pl/plpython/plpython.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index 43d332de20..1f8c27f632 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -4381,8 +4381,13 @@ PLy_elog(int elevel, const char *fmt,...) int position = 0; PyErr_Fetch(&exc, &val, &tb); - if (exc != NULL && PyErr_GivenExceptionMatches(val, PLy_exc_spi_error)) - PLy_get_spi_error_data(val, &detail, &hint, &query, &position); + if (exc != NULL) + { + if (PyErr_GivenExceptionMatches(val, PLy_exc_spi_error)) + PLy_get_spi_error_data(val, &detail, &hint, &query, &position); + else if (PyErr_GivenExceptionMatches(val, PLy_exc_fatal)) + elevel = FATAL; + } PyErr_Restore(exc, val, tb); xmsg = PLy_traceback(&xlevel); -- 2.40.0