Re: pgsql: Transforms for jsonb to PL/Perl - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Transforms for jsonb to PL/Perl
Date
Msg-id 16660.1522856736@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Transforms for jsonb to PL/Perl  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
I wrote:
> Anthony Bykov <a.bykov@postgrespro.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


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix platform and Perl-version dependencies in new jsonb_plperlc
Next
From: Tom Lane
Date:
Subject: pgsql: Remove less-portable-than-believed test case.