pgsql: Remove redundant SvOK() tests in plperl.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove redundant SvOK() tests in plperl.
Date: 2026-08-20 15:26:27
Message-ID: E1wx4ew-00000001NQK-2Cj5@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove redundant SvOK() tests in plperl.

I noticed that some places in our code test "SvOK(sv) && SvROK(sv)"
while others check just SvROK(sv). On investigation, it's clear
that SvROK implies SvOK so testing both is pointless. While removing
these extra checks seems very unlikely to make any performance
difference, it does make the code more consistent and intelligible.

Also mop up a couple of places where there wasn't a null-pointer
check before a SvOK() test. I think these are unreachable cases,
but in the name of consistency let's do it the same everywhere.

Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
Discussion: https://postgr.es/m/2034677.1787172042@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/41868e8aaa6cfff63b1c8010e1356e01d86a1326

Modified Files
--------------
src/pl/plperl/plperl.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-08-20 15:36:24 pgsql: Rewrite tsqueryout() to use StringInfo to build the output strin
Previous Message Robert Treat 2026-08-20 12:52:36 Re: typo in postgres-fdw.sgml - Re: pgsql: postgres_fdw: push down FUNCTION RTE into foreign joins