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