v1-0001-Fix-incorrect-comment-in-JsonTablePlanJoinNextRow.patch

application/octet-stream

Filename: v1-0001-Fix-incorrect-comment-in-JsonTablePlanJoinNextRow.patch
Type: application/octet-stream
Part: 0
Message: Re: [PATCH] Fix wrong comment in JsonTablePlanJoinNextRow()

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v1-0001
Subject: Fix incorrect comment in JsonTablePlanJoinNextRow()
File+
src/backend/utils/adt/jsonpath_exec.c 1 1
From b0677179e116fd91bb5d83a24b517e85c5446a91 Mon Sep 17 00:00:00 2001
From: Amit Langote <amitlan@postgresql.org>
Date: Thu, 16 Apr 2026 11:52:16 +0900
Subject: [PATCH v1] 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 <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/tencent_4CC6316F02DECA61ACCF22F933FEA5C12806@qq.com
Backpatch-through: 17
---
 src/backend/utils/adt/jsonpath_exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/adt/jsonpath_exec.c b/src/backend/utils/adt/jsonpath_exec.c
index 770840a0611..0ec9b4df2ef 100644
--- a/src/backend/utils/adt/jsonpath_exec.c
+++ b/src/backend/utils/adt/jsonpath_exec.c
@@ -4729,7 +4729,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;
 		}
 	}
-- 
2.47.3