pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix platform and Perl-version dependencies in new jsonb_plperl c
Date: Wed, 04 Apr 2018 15:28:57 +0000
Message-ID: <E1f3kLJ-0003jW-AP@gemulon.postgresql.org> (raw)

Fix platform and Perl-version dependencies in new jsonb_plperl code.

Testing SvTYPE() directly is more fraught with problems than one might
think, because depending on context Perl might be storing a scalar value
in one of several forms, eg both numeric and string values.  This resulted
in Perl-version-dependent buildfarm test failures.  Instead use the SvTYPE
test only to distinguish non-scalar cases (AV, HV, NULL).  Disambiguate
scalars by testing SvIOK, SvNOK, then SvPOK.  This creates a preference
order for how we will resolve cases where the value is available in more
than one form, which seems fine to me.

Furthermore, because we're now dealing directly with a "double" value
in the SvNOK case, we can get rid of an inadequate and unportable
string-comparison test for infinities, and use isinf() instead.
(We do need some additional #include and "-lm" infrastructure to use
that in a contrib module, per prior experiences.)

In passing, prevent the regression test results from depending on DROP
CASCADE order; I've not seen that malfunction, but it's trouble waiting
to happen.

Discussion: https://postgr.es/m/E1f3MMJ-0006bf-B0@gemulon.postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/331b2369c0ad1e51d5e50bf5dd75232e0160553a

Modified Files
--------------
contrib/jsonb_plperl/Makefile                   |  2 +
contrib/jsonb_plperl/expected/jsonb_plperl.out  | 26 ++++++---
contrib/jsonb_plperl/expected/jsonb_plperlu.out | 26 ++++++---
contrib/jsonb_plperl/jsonb_plperl.c             | 76 ++++++++++++++-----------
contrib/jsonb_plperl/sql/jsonb_plperl.sql       | 16 +++++-
contrib/jsonb_plperl/sql/jsonb_plperlu.sql      | 16 +++++-
6 files changed, 110 insertions(+), 52 deletions(-)



Message-ID: <E1f3kLJ-0003jW-AP@gemulon.postgresql.org>
Permalink:  ../E1f3kLJ-0003jW-AP@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1f3kLJ-0003jW-AP@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix platform and Perl-version dependencies in new jsonb_plperl c
  In-Reply-To: <E1f3kLJ-0003jW-AP@gemulon.postgresql.org>
  References: <E1f3kLJ-0003jW-AP@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox