summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan2005-11-18 17:00:28 +0000
committerAndrew Dunstan2005-11-18 17:00:28 +0000
commit7c3b3081e849c794d8f3e2d8adb09efcb3b1fc36 (patch)
treee8e12ce00ab376c88dadd00b080acb88871f9f41
parentfa92c25a12ae095a353aa5774c07715ef89efaa1 (diff)
translate undef to NULL for result arrayref, now that we allow NULLs in arrays. Update plperl regression test accordingly.
-rw-r--r--src/pl/plperl/expected/plperl.out8
-rw-r--r--src/pl/plperl/plperl.c6
-rw-r--r--src/pl/plperl/sql/plperl.sql2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/pl/plperl/expected/plperl.out b/src/pl/plperl/expected/plperl.out
index a2b34a78cb..476e98b7b9 100644
--- a/src/pl/plperl/expected/plperl.out
+++ b/src/pl/plperl/expected/plperl.out
@@ -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)
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 75a560ddbd..231c75174e 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -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}); " \
"} "
diff --git a/src/pl/plperl/sql/plperl.sql b/src/pl/plperl/sql/plperl.sql
index e6fc5c35dd..b1f13d3a41 100644
--- a/src/pl/plperl/sql/plperl.sql
+++ b/src/pl/plperl/sql/plperl.sql
@@ -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();