Re: Error when using array_agg with filter where clause in pg16 and pg17 - Mailing list pgsql-bugs

From David Rowley
Subject Re: Error when using array_agg with filter where clause in pg16 and pg17
Date
Msg-id CAApHDvpYfWvRL2D4HRAtsh7GRVZxvtaijZEqJWTwhPGmmSoNRg@mail.gmail.com
Whole thread Raw
In response to Re: Error when using array_agg with filter where clause in pg16 and pg17  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Disabled logical replication origin session causes primary key errors
Next
From: Noah Misch
Date:
Subject: Re: ERROR: tuple to be updated was already modified by an operation triggered by the current command