diff options
author | Andrew Dunstan | 2005-11-18 17:00:28 +0000 |
---|---|---|
committer | Andrew Dunstan | 2005-11-18 17:00:28 +0000 |
commit | 7c3b3081e849c794d8f3e2d8adb09efcb3b1fc36 (patch) | |
tree | e8e12ce00ab376c88dadd00b080acb88871f9f41 | |
parent | fa92c25a12ae095a353aa5774c07715ef89efaa1 (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.out | 8 | ||||
-rw-r--r-- | src/pl/plperl/plperl.c | 6 | ||||
-rw-r--r-- | src/pl/plperl/sql/plperl.sql | 2 |
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(); |