Re: CYCLE over calculates windows functions

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: CYCLE over calculates windows functions
Date: 2026-11-27 08:55:37
Message-ID: 75161E9B-CA7E-4E7F-AFF9-B50DF9C37FA7@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Kirill,

On 25 Nov 2026, Kirill Reshke wrote:
> There are more cases with wrong results (all because of subquery-style
> query rewrite, all cures with 0001).

The SQL draft I checked specifies this subquery rewrite: 7.18
"<search or cycle clause>", Syntax Rule 8, puts the cycle-mark filter
in the outer WHERE, as our current implementation does.

Also, 7.17 "<query expression>", SR 3)j)ix)5)C)II, prohibits window
functions in the recursive SELECT. Supporting them is our extension,
so the standard does not prescribe the window results in your example.

Could you clarify which semantics you want to propose for these extensions
before treating this as a bug fix?

Thank you!

Best regards, Andrey Borodin.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-11-27 09:02:27 Re: Should we skip foreign key checks in binary upgrade mode?
Previous Message Daniel Gustafsson 2026-11-27 08:45:55 Re: [DOC][PATCH] Improving the HTML layout of release notes