Re: pgsql: Transforms for jsonb to PL/Perl

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Anthony Bykov <a(dot)bykov(at)postgrespro(dot)ru>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Transforms for jsonb to PL/Perl
Date: 2018-04-04 15:45:36
Message-ID: 16660.1522856736@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

I wrote:
> Anthony Bykov <a(dot)bykov(at)postgrespro(dot)ru> writes:
>> I guess the right test will look a little bit different:
>> CREATE FUNCTION testRegexpToJsonb() RETURNS jsonb
>> LANGUAGE plperl
>> TRANSFORM FOR TYPE jsonb
>> AS $$
>> $a = qr//;
>> return ($a);
>> $$;

> This is testing something else. I don't object to adding it,
> but we should keep the existing test in some form to verify
> that the bug stays fixed.

Huh. I put that in, and it turns out that on some Perl versions
we get a string out instead of "don't know what that is".

***************
*** 48,55 ****
return ($a);
$$;
SELECT testRegexpToJsonb();
! ERROR: cannot transform this Perl type to jsonb
! CONTEXT: PL/Perl function "testregexptojsonb"
-- this revealed a bug in the original implementation
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
LANGUAGE plperl
--- 48,58 ----
return ($a);
$$;
SELECT testRegexpToJsonb();
! testregexptojsonb
! -------------------
! "(?^:foo)"
! (1 row)
!
-- this revealed a bug in the original implementation
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
LANGUAGE plperl

So that's probably useful for the people it works for,
but I don't think we want a Perl-version-dependent
regression test for this. I'm inclined to just take
this test case out again.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-04-04 15:51:43 pgsql: Remove less-portable-than-believed test case.
Previous Message Tom Lane 2018-04-04 15:28:57 pgsql: Fix platform and Perl-version dependencies in new jsonb_plperl c