Re: BUG #17502: View based on window functions returns wrong results when queried - Mailing list pgsql-bugs

From Ilya Anfimov
Subject Re: BUG #17502: View based on window functions returns wrong results when queried
Date
Msg-id 20220530102753.GA2725032@azor.tzirechnoy.ru
Whole thread Raw
In response to Re: BUG #17502: View based on window functions returns wrong results when queried  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Sun, May 29, 2022 at 10:18:59PM -0400, Tom Lane wrote:
> David Rowley <dgrowleyml@gmail.com> writes:
> > The problem seems to be down to the fact that
> > remove_unused_subquery_outputs() does not check if the to-be-removed
> > target entry references WindowClauses which contain set-returning
> > functions.
> 
> I was sort of wondering why we allow SRFs in this context in the
> first place.  The results don't seem terribly well-defined to me.
> In particular, a WindowFunc invocation is not supposed to change the
> number of rows in the query result, and yet this one is doing so.
 
 I  would like to note, that some SRFs may return only one row in
specific cases, like dblink() with the specific query.
 It may used much more often, than real multirow SRFs in PARTITION BY.

 While converting it to a LATERAL JOIN is not  a lot  of work  --
breaking it in previous versions may affect a lot of people.




pgsql-bugs by date:

Previous
From: Richard Guo
Date:
Subject: Re: BUG #17502: View based on window functions returns wrong results when queried
Next
From: PG Bug reporting form
Date:
Subject: BUG #17503: Package postgresql-jdbc-42.3.6-1.rhel8.noarch.rpm is not signed