summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-05-12 13:08:12 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-05-12 13:08:12 -0400
commit904af8db8a99409257db1eed0b056c8098e9013c (patch)
treeb4533f0bd710f94509d62fda5370a9cc449ab9e6 /src/test
parentf0ed3a8a99b052d2d5e0b6153a8907b90c486636 (diff)
downloadpostgresql-904af8db8a99409257db1eed0b056c8098e9013c.tar.gz
Fix handling of strict non-set functions with NULLs in set-valued inputs.
In a construct like "select plain_function(set_returning_function(...))", the plain function is applied to each output row of the SRF successively. If some of the SRF outputs are NULL, and the plain function is strict, you'd expect to get NULL results for such rows ... but what actually happened was that such rows were omitted entirely from the result set. This was due to confusion of this case with what should happen for nested set-returning functions; a strict SRF is indeed supposed to yield an empty set for null input. Per bug #8150 from Erwin Brandstetter. Although this has been broken forever, we're not back-patching because of the possibility that some apps out there expect the incorrect behavior. This change should be listed as a possible incompatibility in the 9.3 release notes.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/arrays.out9
-rw-r--r--src/test/regress/sql/arrays.sql1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/test/regress/expected/arrays.out b/src/test/regress/expected/arrays.out
index 051bac9234..76a8c56a76 100644
--- a/src/test/regress/expected/arrays.out
+++ b/src/test/regress/expected/arrays.out
@@ -1542,6 +1542,15 @@ select unnest(array[1,2,3,null,4,null,null,5,6]::text[]);
6
(9 rows)
+select abs(unnest(array[1,2,null,-3]));
+ abs
+-----
+ 1
+ 2
+
+ 3
+(4 rows)
+
select array_remove(array[1,2,2,3], 2);
array_remove
--------------
diff --git a/src/test/regress/sql/arrays.sql b/src/test/regress/sql/arrays.sql
index 04e97254e1..e6df37216b 100644
--- a/src/test/regress/sql/arrays.sql
+++ b/src/test/regress/sql/arrays.sql
@@ -432,6 +432,7 @@ select unnest(array[1,2,3,4.5]::float8[]);
select unnest(array[1,2,3,4.5]::numeric[]);
select unnest(array[1,2,3,null,4,null,null,5,6]);
select unnest(array[1,2,3,null,4,null,null,5,6]::text[]);
+select abs(unnest(array[1,2,null,-3]));
select array_remove(array[1,2,2,3], 2);
select array_remove(array[1,2,2,3], 5);
select array_remove(array[1,NULL,NULL,3], NULL);