Re: BUG #17502: View based on window functions returns wrong results when queried

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Daniel Farkaš <daniel(dot)farkas(at)datoris(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17502: View based on window functions returns wrong results when queried
Date: 2022-05-30 02:18:59
Message-ID: 3722616.1653877139@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

David Rowley <dgrowleyml(at)gmail(dot)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.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2022-05-30 02:38:43 Re: BUG #17502: View based on window functions returns wrong results when queried
Previous Message David Rowley 2022-05-30 01:11:53 Re: BUG #17502: View based on window functions returns wrong results when queried