Subject: [PATCH] Fix wrong comment in JsonTablePlanJoinNextRow()

From: "胡传文" <[email-masked]>
Date: Wed, 15 Apr 2026 16:28:44 +0800

Hi,

Found a misleading comment in JsonTablePlanJoinNextRow() while reading
the JSON_TABLE execution code.

The function returns false when both siblings are exhausted (meaning no
more rows), but the comment says "there are more rows" — the exact
opposite of what's happening. The code itself is correct.

if (!JsonTablePlanNextRow(planstate-&gt;right))
{
    /* Right sibling ran out of row, so there are more rows. */  /* wrong */
    return false;
}

A reader might reasonably treat this as a bug and flip the return value,
which would cause JSON_TABLE UNION plans to loop indefinitely.

Patch attached.

Regards,
Chuanwen Hu

---

From: Chao Li <[email-masked]>
Date: Thu, 16 Apr 2026 10:05:08 +0800

> On Apr 15, 2026, at 16:28, 胡传文 <[email-masked]> wrote:
> 
> Hi,
> if (!JsonTablePlanNextRow(planstate->right))
> {
> Chuanwen Hu<fix-jsontable-comment.patch>

The fix looks correct to me. I guess “no” was just unintentionally missed.

A small comment, I just feel “too” you newly added might not be needed.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

---

From: Amit Langote <[email-masked]>
Date: Thu, 16 Apr 2026 12:03:22 +0900

Hi,

> > which would cause JSON_TABLE UNION plans to loop indefinitely.

Thanks for the report and the patch.

> A small comment, I just feel “too” you newly added might not be needed.

Actually, I'd keep it, because it ties the comment to the left-sibling
check just above.

Will push the attached down to v17.

-- 
Thanks, Amit Langote

---

From: Amit Langote <[email-masked]>
Date: Thu, 16 Apr 2026 14:17:22 +0900

> Will push the attached down to v17.

Done.

-- 
Thanks, Amit Langote