Disallow set-returning functions within window OVER clauses.

We previously allowed this, but it leads to odd behaviors, basically
because putting a SRF there is inconsistent with the principle that a
window function doesn't change the number of rows in the query result.
There doesn't seem to be a strong reason to try to make such cases
behave consistently.  Users should put their SRFs in lateral FROM
clauses instead.

This issue has been sitting on the back burner for multiple years
now, partially because it didn't seem wise to back-patch such a
change.  Let's squeeze it into v19 before it's too late.

Bug: #17502
Bug: #19535
Reported-by: Daniel Farkaš <[email protected]>
Reported-by: Qifan Liu <[email protected]>
Author: Tom Lane <[email protected]>
Reviewed-by: David Rowley <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0c15b715c6517af7b1046b45f868425930eaee6f

Modified Files
--------------
src/backend/parser/parse_func.c    |  3 ---
src/test/regress/expected/tsrf.out | 25 +++++++++++++++----------
src/test/regress/sql/tsrf.sql      | 10 +++++++---
3 files changed, 22 insertions(+), 16 deletions(-)

Reply via email to