pgsql: Fix assertion failure with PL/Python exceptions

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix assertion failure with PL/Python exceptions
Date: 2023-09-18 23:32:06
Message-ID: E1qiNin-004e9m-WF@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix assertion failure with PL/Python exceptions

PLy_elog() was not able to handle correctly cases where a SPI called
failed, which would fill in a DETAIL string able to trigger an
assertion. We may want to improve this infrastructure so as it is able
to provide any extra detail information provided by an error stack, but
this is left as a future improvement as it could impact existing error
stacks and any applications that depend on them. For now, the assertion
is removed and a regression test is added to cover the case of a failure
with a detail string.

This problem exists since 2bd78eb8d51c, so backpatch all the way down
with tweaks to the regression tests output added where required.

Author: Alexander Lakhin
Discussion: https://postgr.es/m/18070-ab9c171cbf4ebb0f@postgresql.org
Backpatch-through: 11

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bb65f3c1b25fa7a7e7afe6d4b2fd68c85dd880da

Modified Files
--------------
src/pl/plpython/expected/plpython_error.out | 13 +++++++++++++
src/pl/plpython/expected/plpython_error_5.out | 13 +++++++++++++
src/pl/plpython/plpy_elog.c | 3 ---
src/pl/plpython/sql/plpython_error.sql | 11 +++++++++++
4 files changed, 37 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2023-09-19 01:24:38 pgsql: Improve error message for snapshot import in snapmgr.c, take two
Previous Message Nathan Bossart 2023-09-18 21:06:38 pgsql: Add function for removing arbitrary nodes in binaryheap.