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

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Farkaš <daniel.farkas@datoris.com>, Magnus Hagander <magnus@hagander.net>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2022-05-30T05:24:33Z
Lists: pgsql-bugs

Attachments

On Mon, 30 May 2022 at 15:02, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I'm not necessarily against adding the prohibition in the back
> branches.  However, if this has been wrong since 10.x (if not
> further back) then it seems like few people are tripping over
> the inconsistency.

Yeah, perhaps. But we have received a report from 1 person and I think
it seems strange to adopt a policy that we require multiple bug
reports for the same issue before we consider fixing.

FWIW, just to demonstrate what a fix could look like, I've attached a
patch. I'm not planning to commit it if you really think we shouldn't
be fixing it.

The patch also does nothing for the weirdness that I described in the
DISTINCT ON case earlier in this thread.

David

Commits

  1. Disallow set-returning functions within window OVER clauses.