timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
16.83k stars 852 forks source link

Backport to 2.15.x: #7091: Use processed group clause in PG16 (take 2) #7093

Closed timescale-automation closed 4 days ago

timescale-automation commented 4 days ago

This is an automated backport of #7091: Use processed group clause in PG16 (take 2). This PR will be merged automatically after all the relevant CI checks pass. If this fix should not be backported, or will be backported manually, just close this PR. You can use the backport branch to add your changes, it won't be modified automatically anymore.

For more details, please see the documentation

Original description

Use processed group clause in PG16 (take 2)

In #6377 we fixed an ORDER BY/GROUP BY expression not found in targetlist by using the root->processed_groupClause instead of parse->groupClause due to an optimization introduced in PG16 that removes redundant grouping and distinct columns.

But looks like we didn't change all necessary places, specially our HashAggregate optimization.

Disable-check: force-changelog-file