pgsql: Fix missing error handling in plperl_sv_to_literal().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix missing error handling in plperl_sv_to_literal().
Date: 2026-11-10 21:33:04
Message-ID: E1xQtSi-00000000DvR-01B4@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix missing error handling in plperl_sv_to_literal().

This function should have logic to trap Postgres errors and
convert them to Perl croak(), but it was missing that.
We'd somehow managed not to notice, even though the case of
an error was tested, until commits daafcbd11 et al added more
complexity to the interaction of Postgres and Perl errors.
Even then it mostly worked, but a few PPC64 buildfarm animals
are showing failures that trace to this. Alexander Lakhin
then found that the crash is repeatable on other platforms
if you repeat the test a few times.

This patch basically just copies-and-pastes the error handling
from plperl_spi_exec() into plperl_sv_to_literal().

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3d342deeb433060dbea02fdd276656a5563275d5

Modified Files
--------------
src/pl/plperl/expected/plperl_util.out | 12 ++++-
src/pl/plperl/plperl.c | 88 ++++++++++++++++++++++++++--------
src/pl/plperl/sql/plperl_util.sql | 4 ++
3 files changed, 83 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2026-11-10 21:45:42 Re: pgsql: Add optional parameter to PG_TRY() macros
Previous Message Heikki Linnakangas 2026-11-10 21:27:57 pgsql: Centralize resetting SIGCHLD handler