On Wed, 9 Apr 2025 at 14:55, David Rowley <dgrowleyml@gmail.com> wrote:
> I'm mostly concerned about just a blanket disabling of the presorted
> optimisation when the Aggref has a FILTER. I think that's what you
> proposed at one point. I'm more happy to go with your first proposal
> to try and figure out if the args are safe to sort before filtering.
I did some more work on this and found that with the checking for
implicit cast code I had in my draft patch, it was just a bit too
strange as it allowed implicit casts, but if the query had an explicit
cast doing a conversion that there was an implicit cast defined for,
then the optimisation got disabled because the cast was explicit
rather than implicit. I thought that was too strange, so I went back
with just allowing Vars and Consts after stripping out RelabelTypes.
I didn't want to delay this any longer due to the upcoming minor
releases in 3 weeks, so I've pushed the patch after making those
adjustments and writing some more suitable tests.
David