Re: Improve join_search_one_level readibilty (one line change) - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: Improve join_search_one_level readibilty (one line change)
Date
Msg-id 20230731134837.dpugorvuhtv27b3t@jrouhaud
Whole thread Raw
In response to Re: Improve join_search_one_level readibilty (one line change)  (謝東霖 <douenergy@gmail.com>)
Responses Re: Improve join_search_one_level readibilty (one line change)
List pgsql-hackers
Hi,

On Wed, Jun 07, 2023 at 11:02:09AM +0800, 謝東霖 wrote:
> Thank you, Julien, for letting me know that cfbot doesn't test txt files.
> Much appreciated!

Thanks for posting this v2!

So unsurprisingly the cfbot is happy with this patch, since it doesn't change
the behavior at all.  I just have some nitpicking:

@@ -109,14 +109,14 @@ join_search_one_level(PlannerInfo *root, int level)
             List       *other_rels_list;
             ListCell   *other_rels;

+            other_rels_list = joinrels[1];
+
             if (level == 2)        /* consider remaining initial rels */
             {
-                other_rels_list = joinrels[level - 1];
                 other_rels = lnext(other_rels_list, r);
             }
             else                /* consider all initial rels */
             {
-                other_rels_list = joinrels[1];
                 other_rels = list_head(other_rels_list);
             }


Since each branch only has a single instruction after the change the curly
braces aren't needed anymore.  The only reason keep them is if it helps
readability (like if there's a big comment associated), but that's not the case
here so it would be better to get rid of them.

Apart from that +1 from me for the patch, I think it helps focusing the
attention on what actually matters here.



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: CDC/ETL system on top of logical replication with pgoutput, custom client
Next
From: José Neves
Date:
Subject: RE: CDC/ETL system on top of logical replication with pgoutput, custom client