[PATCH] Fix wrong comment in JsonTablePlanJoinNextRow()

From: 胡传文 <463945512(at)qq(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Fix wrong comment in JsonTablePlanJoinNextRow()
Date: 2026-04-15 08:28:44
Message-ID: tencent_4CC6316F02DECA61ACCF22F933FEA5C12806@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
fix-jsontable-comment.patch application/octet-stream 510 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-04-15 08:30:17 Re: Implement waiting for wal lsn replay: reloaded
Previous Message Aleksander Alekseev 2026-04-15 08:18:28 Re: [PATCH] Miscellaneous little fixes