[PATCH] Fix wrong comment in JsonTablePlanJoinNextRow()

胡传文 <463945512@qq.com>

From: 胡传文 <463945512@qq.com>
To: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-15T08:28:44Z
Lists: pgsql-hackers

Attachments

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

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix incorrect comment in JsonTablePlanJoinNextRow()