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

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: 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-16 09:04:51
Message-ID: CAHewXNkF3LSvR2nTNDVZz3_NJOHK47VO9gE9hb3OGDd_HbMraQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tender Wang <tndrwang(at)gmail(dot)com> 于2024年10月16日周三 16:20写道:

>
>
> Amit Langote <amitlangote09(at)gmail(dot)com> 于2024年10月16日周三 08:35写道:
>
>> On Wed, Oct 16, 2024 at 9:19 AM Michael Paquier <michael(at)paquier(dot)xyz>
>> wrote:
>> > On Tue, Oct 15, 2024 at 11:00:01AM +0000, PG Bug reporting form wrote:
>> > > First bad commit for this anomaly is b6e1157e7.
>> >
>> > Amit, any thoughts?
>>
>> Will look into it, thanks.
>>
>
> Hi,
>
> I debug this issue, and I find that:
> after b6e1157e7, we shouldn't walk JsonValueExpr.raw_expr in
> expression_tree_walker_impl(), which
> is called in preprocess_aggrefs().
>
> I try to above solution, no crashed again.
>
>
I attached a patch. I found a typo comment when I worked on this issue.
But I don't include a test case, because random() result is different
every time, maybe using explain statement.
Any thoughts?

--
Thanks,
Tender Wang

Attachment Content-Type Size
0001-Fix-json_objectagg-crashed-when-including-random-fun.patch application/octet-stream 1.5 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2024-10-16 09:06:33 Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
Previous Message Tender Wang 2024-10-16 08:20:41 Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault