Skip to content

Commit a163c00

Browse files
committed
Tweak targetlist-SRF tests.
Add a test case showing that we don't support SRFs in window-function arguments. Remove a duplicate test case for SRFs in aggregate arguments.
1 parent 55c3391 commit a163c00

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/test/regress/expected/tsrf.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ SELECT few.dataa, count(*) FROM few WHERE dataa = 'a' GROUP BY few.dataa, unnest
159159
-- SRFs are not allowed in aggregate arguments
160160
SELECT min(generate_series(1, 3)) FROM few;
161161
ERROR: set-valued function called in context that cannot accept a set
162+
-- SRFs are not allowed in window function arguments, either
163+
SELECT min(generate_series(1, 3)) OVER() FROM few;
164+
ERROR: set-valued function called in context that cannot accept a set
162165
-- SRFs are normally computed after window functions
163166
SELECT id,lag(id) OVER(), count(*) OVER(), generate_series(1,3) FROM few;
164167
id | lag | count | generate_series
@@ -369,9 +372,6 @@ INSERT INTO fewmore VALUES(1) RETURNING generate_series(1,3);
369372
ERROR: set-returning functions are not allowed in RETURNING
370373
LINE 1: INSERT INTO fewmore VALUES(1) RETURNING generate_series(1,3)...
371374
^
372-
-- nor aggregate arguments
373-
SELECT count(generate_series(1,3)) FROM few;
374-
ERROR: set-valued function called in context that cannot accept a set
375375
-- nor standalone VALUES (but surely this is a bug?)
376376
VALUES(1, generate_series(1,2));
377377
ERROR: set-valued function called in context that cannot accept a set

src/test/regress/sql/tsrf.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ SELECT few.dataa, count(*) FROM few WHERE dataa = 'a' GROUP BY few.dataa, unnest
4747
-- SRFs are not allowed in aggregate arguments
4848
SELECT min(generate_series(1, 3)) FROM few;
4949

50+
-- SRFs are not allowed in window function arguments, either
51+
SELECT min(generate_series(1, 3)) OVER() FROM few;
52+
5053
-- SRFs are normally computed after window functions
5154
SELECT id,lag(id) OVER(), count(*) OVER(), generate_series(1,3) FROM few;
5255
-- unless referencing SRFs
@@ -73,8 +76,7 @@ UPDATE fewmore SET data = generate_series(4,9);
7376

7477
-- SRFs are not allowed in RETURNING
7578
INSERT INTO fewmore VALUES(1) RETURNING generate_series(1,3);
76-
-- nor aggregate arguments
77-
SELECT count(generate_series(1,3)) FROM few;
79+
7880
-- nor standalone VALUES (but surely this is a bug?)
7981
VALUES(1, generate_series(1,2));
8082

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