Skip to content

Commit b410475

Browse files
committed
translate undef to NULL for result arrayref, now that we allow NULLs in arrays. Update plperl regression test accordingly.
1 parent 33e9f2c commit b410475

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/pl/plperl/expected/plperl.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,11 @@ SELECT * FROM recurse(3);
412412
---
413413
CREATE OR REPLACE FUNCTION array_of_text() RETURNS TEXT[][]
414414
LANGUAGE plperl as $$
415-
return [['a"b','c,d'],['e\\f','g']];
415+
return [['a"b',undef,'c,d'],['e\\f',undef,'g']];
416416
$$;
417417
SELECT array_of_text();
418-
array_of_text
419-
-----------------------------
420-
{{"a\"b","c,d"},{"e\\f",g}}
418+
array_of_text
419+
---------------------------------------
420+
{{"a\"b",NULL,"c,d"},{"e\\f",NULL,g}}
421421
(1 row)
422422

src/pl/plperl/plperl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* ENHANCEMENTS, OR MODIFICATIONS.
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.94 2005/10/18 17:13:14 tgl Exp $
36+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.95 2005/11/18 17:00:28 adunstan Exp $
3737
*
3838
**********************************************************************/
3939

@@ -207,12 +207,16 @@ plperl_init_all(void)
207207
" { " \
208208
" $res .= _plperl_to_pg_array($elem); " \
209209
" } " \
210-
" else " \
210+
" elsif (defined($elem)) " \
211211
" { " \
212212
" my $str = qq($elem); " \
213213
" $str =~ s/([\"\\\\])/\\\\$1/g; " \
214214
" $res .= qq(\"$str\"); " \
215215
" } " \
216+
" else " \
217+
" { "\
218+
" $res .= 'NULL' ; " \
219+
" } "\
216220
" } " \
217221
" return qq({$res}); " \
218222
"} "

src/pl/plperl/sql/plperl.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ SELECT * FROM recurse(3);
297297
---
298298
CREATE OR REPLACE FUNCTION array_of_text() RETURNS TEXT[][]
299299
LANGUAGE plperl as $$
300-
return [['a"b','c,d'],['e\\f','g']];
300+
return [['a"b',undef,'c,d'],['e\\f',undef,'g']];
301301
$$;
302302

303303
SELECT array_of_text();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy