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

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tender Wang <tndrwang(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
Date: 2024-10-18 06:14:06
Message-ID: CA+HiwqGWJDVEscvUuXsUhFw6_=T+MbdbKVLb_NxtH4byJoMiJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Oct 18, 2024 at 2:03 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> On Fri, Oct 18, 2024 at 1:38 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > On Fri, Oct 18, 2024 at 11:04 AM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > > On Fri, Oct 18, 2024 at 5:30 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

Attachment Content-Type Size
v7-0001-SQL-JSON-Fix-some-oversights-in-commit-b6e1157e7.patch application/octet-stream 8.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2024-10-18 08:00:00 Re: BUG #18658: Assert in SerialAdd() due to race condition
Previous Message Michael Paquier 2024-10-18 05:51:32 Re: BUG #18614: [ECPG] out of bound in DecodeDateTime