pgsql: Tighten coding for non-composite case in plperl's return_next.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Tighten coding for non-composite case in plperl's return_next.
Date: 2017-07-31 15:33:52
Message-ID: E1dcChc-0003hB-49@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tighten coding for non-composite case in plperl's return_next.

Coverity complained about this code's practice of using scalar variables
as single-element arrays. While that's really just nitpicking, it probably
is more readable to declare them as arrays, so let's do that. A more
important point is that the code was just blithely assuming that the
result tupledesc has exactly one column; if it doesn't, we'd likely get
a crash of some sort in tuplestore_putvalues. Since the tupledesc is
manufactured outside of plperl, that seems like an uncomfortably long
chain of assumptions. We can nail it down at little cost with a sanity
check earlier in the function.

Branch
------
master

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

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

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-07-31 16:38:58 pgsql: PL/Perl portability fix: avoid including XSUB.h in plperl.c.
Previous Message Stephen Frost 2017-07-31 14:38:16 pgsql: Fix function comment for dumpACL()