0001-avoid-redudant-result-node.patch

application/octet-stream

Filename: 0001-avoid-redudant-result-node.patch
Type: application/octet-stream
Part: 0
Message: Re: Redundant Result node

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: unified
Series: patch 0001
File+
src/backend/optimizer/plan/planner.c 4 2
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index b5827d3980..95914a1784 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -5301,7 +5301,8 @@ create_ordered_paths(PlannerInfo *root,
 		}
 
 		/* Add projection step if needed */
-		if (sorted_path->pathtarget != target)
+		if (sorted_path->pathtarget != target &&
+		    memcmp(sorted_path->pathtarget, target, sizeof(PathTarget)) != 0)
 			sorted_path = apply_projection_to_path(root, ordered_rel,
 												   sorted_path, target);
 
@@ -5379,7 +5380,8 @@ create_ordered_paths(PlannerInfo *root,
 										 &total_groups);
 
 			/* Add projection step if needed */
-			if (sorted_path->pathtarget != target)
+			if (sorted_path->pathtarget != target &&
+				memcmp(sorted_path->pathtarget, target, sizeof(PathTarget)) != 0)
 				sorted_path = apply_projection_to_path(root, ordered_rel,
 													   sorted_path, target);