]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Disallow set-returning functions within window OVER clauses.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 30 Jun 2026 21:21:23 +0000 (17:21 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 30 Jun 2026 21:21:23 +0000 (17:21 -0400)
commit1de468099d27f44c1998c9c2251cd2aefcfab524
treec05bbea618db112ec7bf3feea5b31de54d31a233
parent57f19774d6c88f501c835a7772a71ca5ba2bc163
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š <daniel.farkas@datoris.com>
Reported-by: Qifan Liu <imchifan@163.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/17502-281a7aaacfaa872a@postgresql.org
Discussion: https://postgr.es/m/19535-376081d7cc07c86d@postgresql.org
Backpatch-through: 19
src/backend/parser/parse_func.c
src/test/regress/expected/tsrf.out
src/test/regress/sql/tsrf.sql