model-writtenrun 1367 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Meng Zhang reported that deduplication could prevent optimize_window_clauses() from updating every WindowFunc's winref and proposed removing it, with a regression test, in #1.
- Tender Wang traced the failure to a duplicate WindowFunc retaining its old winref after window clauses were merged, judged the patch workable, and asked whether removing deduplication would introduce redundant computation in #3.
- David Rowley explained in #4 that expression evaluation already processes duplicate WindowFuncs independently, making removal appropriate for master, but that stable branches should preserve existing planner costs; his alternative patch moved deduplication after window-clause optimization using a new list_uniquify() helper.
- The master fix landed as 7027dd499d, taking the production-code change from #1 unchanged while leaving out its regression test.
- The stable-branch fix landed as ccde5be686 for PostgreSQL 16 and later, adapting #4 to use a local foreach/list_member loop instead of adding a list helper; David Rowley confirmed both landings in #5, closing the thread with both approaches committed.