Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault

Amit Langote <amitlangote09@gmail.com>

From: Amit Langote <amitlangote09@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Tender Wang <tndrwang@gmail.com>, Michael Paquier <michael@paquier.xyz>, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2024-10-18T06:14:06Z
Lists: pgsql-bugs

Attachments

On Fri, Oct 18, 2024 at 2:03 PM Amit Langote <amitlangote09@gmail.com> wrote:
> On Fri, Oct 18, 2024 at 1:38 PM Amit Langote <amitlangote09@gmail.com> wrote:
> > On Fri, Oct 18, 2024 at 11:04 AM Amit Langote <amitlangote09@gmail.com> wrote:
> > > On Fri, Oct 18, 2024 at 5:30 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > > > I do think that reverting the ExecInitExprRec and
> > > > eval_const_expressions_mutator changes would be good,
> > >
> > > What was there in eval_const_expressions_mutator() before b6e1157e was
> > > there because only raw_expr contained the actual expression and
> > > formatted_expr only a wrapper for coercion, but that's not true after
> > > b6e1157e.  So I don't think we can revert
> > > eval_const_expressions_mutator() changes.  The expression tree in
> > > raw_expr does get the eval_const_expressions_mutator() treatment via
> > > ece_generic_processing() at the bottom.
> > >
> > > > but we can't undo the parser changes, at least not in v16/v17.
> > >
> > > Ok, understood.
> > >
> > > I think we can apply the attached down to v16.
> >
> > Here's a version with an updated commit message and the comments of
> > JsonValueExpr struct definition updated to describe raw_expr and
> > formatted_expr more clearly.
>
> Oops, had forgotten to update the regression test comment which still
> contained the previous root cause description.
>
> Updated again.

Another version which expands the comment of JsonValueExpr a little further.

-- 
Thanks, Amit Langote

Commits

  1. SQL/JSON: Fix some oversights in commit b6e1157e7

  2. Don't include CaseTestExpr in JsonValueExpr.formatted_expr