Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
Date
Msg-id 711200.1729197017@sss.pgh.pa.us
Whole thread Raw
In response to BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
List pgsql-bugs
Amit Langote <amitlangote09@gmail.com> writes:
> On Thu, Oct 17, 2024 at 1:12 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> In the short term, I suspect the only workable fix is to undo the
>> optimization of having ExecInitExprRec not recurse into both raw_expr
>> and formatted_expr.

> This or actually I'm tempted to simply revert the whole thing
> (b6e1157e7d3) as an ill-considered refactoring, because I am not able
> to convince myself that calling ExecAggPlainTransByVal() twice, via
> both raw_expr and formatted_expr, is always safe.

Not following the concern here?  As far as nodeAgg is concerned,
they'd be two independent aggregates.

In any case, whatever we do in master, you can't "simply revert"
b6e1157e7 in released branches.  It changed the way JsonValueExpr is
represented in stored rules, and you don't get to undo that midstream.
(The commit should have included a catversion bump, in fact.)

I do think that reverting the ExecInitExprRec and
eval_const_expressions_mutator changes would be good, but we
can't undo the parser changes, at least not in v16/v17.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18662: ORDER BY after GROUPING SETS does not order correctly for certain WHERE condition
Next
From: Thomas Munro
Date:
Subject: Re: Reference to - BUG #18349: ERROR: invalid DSA memory alloc request size 1811939328, CONTEXT: parallel worker