agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Disallow set-returning functions within window OVER clauses.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Disallow set-returning functions within window OVER clauses.
@ 2026-06-30 21:21 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2026-06-30 21:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1de468099d27f44c1998c9c2251cd2aefcfab524

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Disallow set-returning functions within window OVER clauses.
@ 2026-06-30 21:21 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2026-06-30 21:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-06-30 21:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-30 21:21 pgsql: Disallow set-returning functions within window OVER clauses. Tom Lane <tgl@sss.pgh.pa.us>
2026-06-30 21:21 pgsql: Disallow set-returning functions within window OVER clauses. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox