This is an automated backport of #7080: Fix corresponding equivalence member not found.
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.
When querying compressed data we determine whether the requested ORDER
can be applied to the underlying query on the compressed data itself.
This happens twice. The first time we decide whether we can push down
the sort and then we do a recheck when we setup the sort metadata.
Unfortunately those two checks did not agree. The initial check concluded
it is possible but the recheck disagreed. This was due to a bug when
checking the query properties we mixed up the attnos and used attnos
from uncompressed chunk and compressed chunk in the same bitmapset.
If a segmentby column with equality constraint was present in the WHERE
clause whose attno was identical to a compressed attno of a different
column that was part of the ORDER BY the recheck would fail.
This patch removes the recheck and relies on the initial assesment
when building sort metadata.
This is an automated backport of #7080: Fix
corresponding equivalence member not found
. 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
Fix
corresponding equivalence member not found
When querying compressed data we determine whether the requested ORDER can be applied to the underlying query on the compressed data itself. This happens twice. The first time we decide whether we can push down the sort and then we do a recheck when we setup the sort metadata. Unfortunately those two checks did not agree. The initial check concluded it is possible but the recheck disagreed. This was due to a bug when checking the query properties we mixed up the attnos and used attnos from uncompressed chunk and compressed chunk in the same bitmapset. If a segmentby column with equality constraint was present in the WHERE clause whose attno was identical to a compressed attno of a different column that was part of the ORDER BY the recheck would fail.
This patch removes the recheck and relies on the initial assesment when building sort metadata.