Hello hackers

Attached is my first patch for PostgreSQL, which is a simple one-liner
that I believe can improve the code.

In the "join_search_one_level" function, I noticed that the variable
"other_rels_list" always refers to "joinrels[1]" even when the (level
== 2) condition is met. I propose changing:

"other_rels_list = joinrels[level - 1]" to "other_rels_list = joinrels[1]"

This modification aims to enhance clarity and avoid unnecessary instructions.

I would greatly appreciate any review and feedback on this patch as I
am a newcomer to PostgreSQL contributions. Your input will help me
improve and contribute effectively to the project.

I have followed the excellent guide "How to submit a patch by email,
2023 edition" by Peter Eisentraut.

Additionally, if anyone has any tips on ensuring that Gmail recognizes
my attached patches as the "text/x-patch" MIME type when sending them
from the Chrome client, I would be grateful for the advice.

Or maybe the best practice is to use Git send-email ?

Thank you for your time.

Best regards
Alex Hsieh
From 18d2ed81d3640881082bf37d6e3021ffe671d215 Mon Sep 17 00:00:00 2001
From: DouEnergy <douenergy@protonmail.com>
Date: Fri, 2 Jun 2023 20:58:07 +0800
Subject: [PATCH] Improve left deep tree dp algorithm's readability

---
 src/backend/optimizer/path/joinrels.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c
index 2feab2184f..bca78d07fa 100644
--- a/src/backend/optimizer/path/joinrels.c
+++ b/src/backend/optimizer/path/joinrels.c
@@ -111,7 +111,7 @@ join_search_one_level(PlannerInfo *root, int level)
 
 			if (level == 2)		/* consider remaining initial rels */
 			{
-				other_rels_list = joinrels[level - 1];
+				other_rels_list = joinrels[1];
 				other_rels = lnext(other_rels_list, r);
 			}
 			else				/* consider all initial rels */
-- 
2.37.1 (Apple Git-137.1)

Reply via email to