]> granicus.if.org Git - postgresql/commitdiff
translate undef to NULL for result arrayref, now that we allow NULLs in arrays. Updat...
authorAndrew Dunstan <andrew@dunslane.net>
Fri, 18 Nov 2005 17:00:28 +0000 (17:00 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Fri, 18 Nov 2005 17:00:28 +0000 (17:00 +0000)
src/pl/plperl/expected/plperl.out
src/pl/plperl/plperl.c
src/pl/plperl/sql/plperl.sql

index a2b34a78cbff79347c42fa213eba1d29c0df0f3d..476e98b7b948f33649748c210e4488518776fcd6 100644 (file)
@@ -412,11 +412,11 @@ SELECT * FROM recurse(3);
 ---
 CREATE OR REPLACE FUNCTION  array_of_text() RETURNS TEXT[][] 
 LANGUAGE plperl as $$ 
-    return [['a"b','c,d'],['e\\f','g']]; 
+    return [['a"b',undef,'c,d'],['e\\f',undef,'g']]; 
 $$;
 SELECT array_of_text(); 
-        array_of_text        
------------------------------
- {{"a\"b","c,d"},{"e\\f",g}}
+             array_of_text             
+---------------------------------------
+ {{"a\"b",NULL,"c,d"},{"e\\f",NULL,g}}
 (1 row)
 
index 01d7b2453b17891867b4d7d341f0a8d430b18010..274add609b3aa405ccf9a6e6f6da2e419dc881bd 100644 (file)
@@ -33,7 +33,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.94 2005/10/18 17:13:14 tgl Exp $
+ *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.95 2005/11/18 17:00:28 adunstan Exp $
  *
  **********************************************************************/
 
@@ -207,12 +207,16 @@ plperl_init_all(void)
        "    { " \
        "      $res .= _plperl_to_pg_array($elem); " \
        "    } " \
-       "    else " \
+       "    elsif (defined($elem)) " \
        "    { " \
        "      my $str = qq($elem); " \
        "      $str =~ s/([\"\\\\])/\\\\$1/g; " \
        "      $res .= qq(\"$str\"); " \
        "    } " \
+       "    else " \
+       "    { "\
+       "      $res .= 'NULL' ; " \
+       "    } "\
        "  } " \
        "  return qq({$res}); " \
        "} "
index e6fc5c35ddee02268cb20473b978a507523b10ce..b1f13d3a4134c31aaa1c6f30250800817811004e 100644 (file)
@@ -297,7 +297,7 @@ SELECT * FROM recurse(3);
 ---
 CREATE OR REPLACE FUNCTION  array_of_text() RETURNS TEXT[][] 
 LANGUAGE plperl as $$ 
-    return [['a"b','c,d'],['e\\f','g']]; 
+    return [['a"b',undef,'c,d'],['e\\f',undef,'g']]; 
 $$;
 
 SELECT array_of_text();