aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-09-14 19:48:42 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-09-14 19:48:50 -0400
commit0dac5b5174bde3d6fb4b444a2aa4ca1f0091e258 (patch)
tree19b2a5da4bbdd485275b32444280d9b76c1e3f31 /src
parent6415ba502bdc540e21f122d4c6c87d4a35f8ec27 (diff)
downloadpostgresql-0dac5b5174bde3d6fb4b444a2aa4ca1f0091e258.tar.gz
postgresql-0dac5b5174bde3d6fb4b444a2aa4ca1f0091e258.zip
Tweak targetlist-SRF tests some more.
Seems like it would be good to have a test case documenting the existing behavior for non-top-level SRFs.
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/expected/tsrf.out11
-rw-r--r--src/test/regress/sql/tsrf.sql6
2 files changed, 17 insertions, 0 deletions
diff --git a/src/test/regress/expected/tsrf.out b/src/test/regress/expected/tsrf.out
index e9bea411fd4..d9a5f137dc0 100644
--- a/src/test/regress/expected/tsrf.out
+++ b/src/test/regress/expected/tsrf.out
@@ -375,6 +375,17 @@ LINE 1: INSERT INTO fewmore VALUES(1) RETURNING generate_series(1,3)...
-- nor standalone VALUES (but surely this is a bug?)
VALUES(1, generate_series(1,2));
ERROR: set-valued function called in context that cannot accept a set
+-- We allow tSRFs that are not at top level
+SELECT int4mul(generate_series(1,2), 10);
+ int4mul
+---------
+ 10
+ 20
+(2 rows)
+
+-- but SRFs in function RTEs must be at top level (annoying restriction)
+SELECT * FROM int4mul(generate_series(1,2), 10);
+ERROR: set-valued function called in context that cannot accept a set
-- DISTINCT ON is evaluated before tSRF evaluation if SRF is not
-- referenced either in ORDER BY or in the DISTINCT ON list. The ORDER
-- BY reference can be implicitly generated, if there's no other ORDER BY.
diff --git a/src/test/regress/sql/tsrf.sql b/src/test/regress/sql/tsrf.sql
index b0dfc193ace..4f854c8b83b 100644
--- a/src/test/regress/sql/tsrf.sql
+++ b/src/test/regress/sql/tsrf.sql
@@ -80,6 +80,12 @@ INSERT INTO fewmore VALUES(1) RETURNING generate_series(1,3);
-- nor standalone VALUES (but surely this is a bug?)
VALUES(1, generate_series(1,2));
+-- We allow tSRFs that are not at top level
+SELECT int4mul(generate_series(1,2), 10);
+
+-- but SRFs in function RTEs must be at top level (annoying restriction)
+SELECT * FROM int4mul(generate_series(1,2), 10);
+
-- DISTINCT ON is evaluated before tSRF evaluation if SRF is not
-- referenced either in ORDER BY or in the DISTINCT ON list. The ORDER
-- BY reference can be implicitly generated, if there's no other ORDER BY.