Re: BUG #17495: Regression in 15beta1 when filtering subquery including row_number window function

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: jeremyevans0@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2022-05-25T00:51:42Z
Lists: pgsql-bugs
On Tue, May 24, 2022 at 04:17:35PM +0000, PG Bug reporting form wrote:
> From testing with 15beta1, I think there is a regression in filtering a
> subquery using the result of the row_number window function.  Here is the
> code:
> 
> This was discovered by the tests for Sequel, a Ruby database access
> library.

Inconsistency reproduced here, thanks for the detailed report and the
test case!  I have added an open item:
https://wiki.postgresql.org/wiki/PostgreSQL_15_Open_Items
--
Michael

Commits

  1. Teach remove_unused_subquery_outputs about window run conditions