On Sun, Feb 4, 2024 at 6:57 AM Andrei Lepikhov
<a.lepikhov@postgrespro.ru> wrote:
> The simple fix is in the attachment. But I'm not sure we should fix
> GROUP-BY optimization instead of the more general issue.
> The source of the problem is root->group_pathkeys, which contains
> grouping pathkeys and aggregate pathkeys. For now, their 'sortref'
> values could intersect, and we can differ which one references the query
> target list and which one the target list of the aggregate.
> So, I would like to get advice here: should we make a quick fix here, or
> is such a mess in the sortref values not a mess and designed for some
> purposes?
Thank you, Andrei. I think we should apply this fix for now, while
better refactoring could be done in future. I've revised your fix
with more comments and a commit message. I'm going to push it if
there are no objections.
------
Regards,
Alexander Korotkov