Re: Error when using array_agg with filter where clause in pg16 and pg17

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kaimeh <kkaimeh(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Error when using array_agg with filter where clause in pg16 and pg17
Date: 2025-04-20 10:21:25
Message-ID: CAApHDvpYfWvRL2D4HRAtsh7GRVZxvtaijZEqJWTwhPGmmSoNRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 9 Apr 2025 at 14:55, David Rowley <dgrowleyml(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2025-04-21 04:06:05 Re: ERROR: tuple to be updated was already modified by an operation triggered by the current command
Previous Message Masahiko Sawada 2025-04-20 05:53:26 Re: Disabled logical replication origin session causes primary key errors