Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3kbf-000281-98 for pgsql-committers@arkaria.postgresql.org; Wed, 04 Apr 2018 15:45:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f3kbb-0005gZ-HO for pgsql-committers@arkaria.postgresql.org; Wed, 04 Apr 2018 15:45:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3kbb-0005g6-8t for pgsql-committers@lists.postgresql.org; Wed, 04 Apr 2018 15:45:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3kbX-00013d-19 for pgsql-committers@lists.postgresql.org; Wed, 04 Apr 2018 15:45:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w34Fjagt016661; Wed, 4 Apr 2018 11:45:36 -0400 From: Tom Lane To: Anthony Bykov cc: Peter Eisentraut , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Transforms for jsonb to PL/Perl In-reply-to: <30494.1522851983@sss.pgh.pa.us> References: <13723.1522768121@sss.pgh.pa.us> <3001.1522769607@sss.pgh.pa.us> <15089.1522791424@sss.pgh.pa.us> <20180404161144.37d03301@anthony-24-g082ur> <30494.1522851983@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 04 Apr 2018 10:26:23 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16659.1522856736.1@sss.pgh.pa.us> Date: Wed, 04 Apr 2018 11:45:36 -0400 Message-ID: <16660.1522856736@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Anthony Bykov 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