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
------
REL_18_STABLE

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

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(-)

Reply via email to