diff options
author | David Rowley <drowley@postgresql.org> | 2025-10-09 12:38:33 +1300 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2025-10-09 12:38:33 +1300 |
commit | a5a68dd6d5159626360f75ffde96eca879e6cc30 (patch) | |
tree | b0e0d021cb79896e952b5fcf0c74e90db6b42d35 /src/backend/optimizer/plan | |
parent | 5e89985928795f243dc287210c2aa016dfd00bfe (diff) |
Make truncate_useless_pathkeys() consider WindowFuncsHEADorigin/masterorigin/HEADmaster
truncate_useless_pathkeys() seems to have neglected to account for
PathKeys that might be useful for WindowClause evaluation. Modify it so
that it properly accounts for that.
Making this work required adjusting two things:
1. Change from checking query_pathkeys to check sort_pathkeys instead.
2. Add explicit check for window_pathkeys
For #1, query_pathkeys gets set in standard_qp_callback() according to the
sort order requirements for the first operation to be applied after the
join planner is finished, so this changes depending on which upper
planner operations a particular query needs. If the query has window
functions and no GROUP BY, then query_pathkeys gets set to
window_pathkeys. Before this change, this meant PathKeys useful for the
ORDER BY were not accounted for in queries with window functions.
Because of #1, #2 is now required so that we explicitly check to ensure
we don't truncate away PathKeys useful for window functions.
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAApHDvrj3HTKmXoLMbUjTO=_MNMxM=cnuCSyBKidAVibmYPnrg@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/plan')
0 files changed, 0 insertions, 0 deletions