Re: BUG #19046: Incorrect result when using json_array() with column reference in subquery combined with RIGHT JOIN

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: runyuan(at)berkeley(dot)edu, pgsql-bugs(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: BUG #19046: Incorrect result when using json_array() with column reference in subquery combined with RIGHT JOIN
Date: 2025-09-11 03:10:15
Message-ID: CAMbWs4-8iPbMZy3+pTvM1EkTyYNGVhX+GX+d9MUXYpYGkB6qJg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Sep 11, 2025 at 10:40 AM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
> Richard Guo <guofenglinux(at)gmail(dot)com> 于2025年9月10日周三 21:29写道:
>> I'm wondering if this is the only case we've overlooked. How about
>> other Json-related expressions?

> Yeah, I have the same question. I tried my fix on json_object/json_arrayagg/json_objectagg.
> These returned the same results.

json_object is also represented as a JsonConstructorExpr.

json_arrayagg and json_objectagg are aggregates, so the subquery won't
be pulled up in the first place.

I tested JsonExpr, which is the representation of json_value,
json_query and json_exists. It seems that they could not produce
non-NULL output with a NULL input. So we are good on that front.

- Richard

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-09-11 03:16:33 Re: BUG #19046: Incorrect result when using json_array() with column reference in subquery combined with RIGHT JOIN
Previous Message Tender Wang 2025-09-11 01:40:27 Re: BUG #19046: Incorrect result when using json_array() with column reference in subquery combined with RIGHT JOIN