From: Amit Langote Date: Thu, 16 Apr 2026 02:52:16 +0000 (+0900) Subject: Fix incorrect comment in JsonTablePlanJoinNextRow() X-Git-Tag: REL_17_10~61 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=1a2d60cc0410c19484a389aee5dc41d28541b0f8;p=thirdparty%2Fpostgresql.git Fix incorrect comment in JsonTablePlanJoinNextRow() The comment on the return-false path when both UNION siblings are exhausted said "there are more rows," which is the opposite of what the code does. The code itself is correct, returning false to signal no more rows, but the misleading comment could tempt a reader into "fixing" the return value, which would cause UNION plans to loop indefinitely. Back-patch to 17, where JSON_TABLE was introduced. Author: Chuanwen Hu <463945512@qq.com> Reviewed-by: Chao Li Discussion: https://postgr.es/m/tencent_4CC6316F02DECA61ACCF22F933FEA5C12806@qq.com Backpatch-through: 17 --- diff --git a/src/backend/utils/adt/jsonpath_exec.c b/src/backend/utils/adt/jsonpath_exec.c index accadff6d8a..9b7187e935f 100644 --- a/src/backend/utils/adt/jsonpath_exec.c +++ b/src/backend/utils/adt/jsonpath_exec.c @@ -4420,7 +4420,7 @@ JsonTablePlanJoinNextRow(JsonTablePlanState *planstate) */ if (!JsonTablePlanNextRow(planstate->right)) { - /* Right sibling ran out of row, so there are more rows. */ + /* Right sibling ran out of rows too, so there are no more rows. */ return false; } }