---
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)
* 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 $
*
**********************************************************************/
" { " \
" $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}); " \
"} "
---
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();