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

From Amit Langote
Subject Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
Date
Msg-id CA+HiwqGZV2YWvso8B4bpPAEJDuEhDos3oUTxDTfr9kpX=nOAgA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
List pgsql-bugs
On Wed, Oct 16, 2024 at 11:26 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Amit Langote <amitlangote09@gmail.com> writes:
> > Also, it might be better to leave a comment where the commit is
> > removing code, as follows:
>
> > -                if (WALK(jve->raw_expr))
> > -                    return true;
> > +                /* Ignore raw_expr because it's not relevant at runtime. */
>
> Would it be better for parse analysis to explicitly NULL out this
> field once it's done looking at it?  Carrying unmaintained pieces
> of an expression tree around seems both inefficient and prone to
> future failures of this same ilk.  The further the raw_expr gets
> out of step with current reality, the worse the hazards.

It seems we can't do that in this case, because get_rule_expr() wants
to read it.

--
Thanks, Amit Langote



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18656: "STABLE" function sometimes does not see changes
Next
From: Tom Lane
Date:
Subject: Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault