Fix a reference error for window functions: In the function 'find_window_functions', the deduplication logic should be removed

Meng Zhang <mza117jc@gmail.com>

From: Meng Zhang <mza117jc@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2026-01-25T04:09:27Z
Lists: pgsql-hackers

Attachments

The deduplication logic won't cause an error when the result of this
function is only used in `select_active_windows`.
But when the result is used in `optimize_window_clauses`, it will cause the
`winref` field of a certain window function to not be modified in the new
window.

Commits

  1. Fix possible issue of a WindowFunc being in the wrong WindowClause

  2. Remove deduplication logic from find_window_functions

  3. Allow window functions to adjust their frameOptions