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-17 00:38:04
Message-ID: CA+HiwqGZV2YWvso8B4bpPAEJDuEhDos3oUTxDTfr9kpX=nOAgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Oct 16, 2024 at 11:26 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Amit Langote <amitlangote09(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-10-17 00:56:52 Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
Previous Message Tom Lane 2024-10-16 21:40:23 Re: BUG #18656: "STABLE" function sometimes does not see changes