Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb410475

Browse files
committed
translate undef to NULL for result arrayref, now that we allow NULLs in arrays. Update plperl regression test accordingly.
1 parent33e9f2c commitb410475

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 REPLACEFUNCTIONarray_of_text() RETURNSTEXT[][]
299299
LANGUAGE plperlas $$
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)

[8]ページ先頭

©2009-2025 Movatter.jp