Re: BUG #18070: Assertion failed when processing error from plpy's iterator

Поиск
Список
Период
Сортировка
От Alexander Lakhin
Тема Re: BUG #18070: Assertion failed when processing error from plpy's iterator
Дата
Msg-id 9fa9c154-d084-07de-8224-aab7fc8a119e@gmail.com
обсуждение исходный текст
Ответ на BUG #18070: Assertion failed when processing error from plpy's iterator  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18070: Assertion failed when processing error from plpy's iterator  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-bugs
25.08.2023 17:00, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference:      18070
> ...
> It looks like the following coding in PLy_elog_impl():
>         /* Since we have a format string, we cannot have a SPI detail. */
>         Assert(detail == NULL);
>
>         /* If there's an exception message, it goes in the detail. */
>         if (xmsg)
>             detail = xmsg;
>
> doesn't expect to process a call PLy_elog(LEVEL, "message") when some (SPI)
> error occurred before the call.
>

Please look at the patch attached, which removes the Assert and changes
the detail message e.g. , for the query:
CREATE EXTENSION plpython3u;
CREATE TYPE tst AS (t text);
CREATE FUNCTION pyfunc() RETURNS SETOF text AS $$
   plan = plpy.prepare("SELECT * FROM tst", ["text"])
   for row in plpy.cursor(plan, ["w"]):
     yield row[0]
$$ LANGUAGE plpython3u;

SELECT pyfunc();

From:
ERROR:  error fetching next item from iterator
LINE 1: SELECT * FROM tst
                       ^
DETAIL:  spiexceptions.WrongObjectType: cannot open relation "tst"
QUERY:  SELECT * FROM tst
CONTEXT:  Traceback (most recent call last):
PL/Python function "pyfunc"

To:
ERROR:  error fetching next item from iterator
LINE 1: SELECT * FROM tst
                       ^
DETAIL:  This operation is not supported for composite types.
QUERY:  SELECT * FROM tst
CONTEXT:  Traceback (most recent call last):
PL/Python function "pyfunc"

Best regards,
Alexander
Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: the same time value return different values,is it a problem
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause